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.
This commit is contained in:
ad 1999-07-25 22:50:28 +00:00
parent 6e3b46de7d
commit 724365fa3e
14 changed files with 242 additions and 336 deletions

View File

@ -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 fbuaccess cfbu;
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 @@ struct fbdriver cfb_driver = {
};
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 @@ void cfbattach __P((struct device *, struct device *, void *));
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 @@ cfbattach(parent, self, aux)
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 @@ cfbattach(parent, self, aux)
* 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 @@ cfbinit(fi, cfbaddr, unit, silent)
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 @@ cfbinit(fi, cfbaddr, unit, silent)
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 @@ cfbinit(fi, cfbaddr, unit, silent)
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 @@ cfbinit(fi, cfbaddr, unit, silent)
/* 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 @@ int
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);
}

View File

@ -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 @@ u_short defCursor[32] = {
#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 @@ void
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 @@ fbconnect (name, info, silent)
/*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
* (i.e. if the device has not been configured before). Always return ptr
* to struct fbinfo in 'fip' for that device, unless there are more fb's
* probed than configured.
*/
int
fballoc(base, fip)
caddr_t base;
struct fbinfo **fip;
{
int i;
if (base == NULL)
printf("fballoc: base == NULL");
for (i = 0; i < NFB; i++) {
/* Free entry? */
if (fbdevs[i].fd_base == NULL)
break;
/* Already configured? */
if (fbdevs[i].fd_base == base) {
*fip = &fbdevs[i].fd_info;
return (-1);
}
}
if (i == NFB) {
printf("fballoc: more framebuffers probed than configured!\n");
*fip = NULL;
return (-1);
}
fbndevs = i + 1;
fbdevs[i].fd_base = base;
*fip = &fbdevs[i].fd_info;
/* Console? */
if (i == 0)
(*fip)->fi_cmap_bits = cmap_bits;
else {
(*fip)->fi_cmap_bits = malloc(768, M_DEVBUF, M_NOWAIT);
if ((*fip)->fi_cmap_bits == NULL) {
printf("fballoc: no memory for cmap\n");
return (-1);
}
}
return (0);
}
#include "fb_usrreq.c" /* old pm-compatible driver that supports X11R5/R6 */
/*
@ -300,13 +320,3 @@ tb_kbdmouseconfig(fi)
return (0);
}
/*
* pre-rcons glass-tty emulator (stub)
*/
void
fbScreenInit(fi)
struct fbinfo *fi;
{
/* how to do this on rcons ? */
}

View File

@ -1,10 +1,4 @@
/* $NetBSD: fb_usrreq.c,v 1.15 1999/04/24 08:01:04 simonb Exp $ */
/*
* XXX this should be stored in 'fbinfo', but that might just break the
* staticly linked Xserver.
*/
static u_char saved_cmap[NFB][768];
/* $NetBSD: fb_usrreq.c,v 1.16 1999/07/25 22:50:28 ad Exp $ */
/*ARGSUSED*/
int
@ -15,23 +9,26 @@ fbopen(dev, flag, mode, p)
{
struct fbinfo *fi;
#ifdef fpinitialized
if (!fp->initialized)
return (ENXIO);
#endif
if (minor(dev) >= fbcd.cd_ndevs ||
(fi = fbcd.cd_devs[minor(dev)]) == NULL)
if (minor(dev) >= fbndevs)
return(ENXIO);
fi = &fbdevs[minor(dev)].fd_info;
if (fi->fi_open)
return (EBUSY);
/* Save colormap for 8bpp devices */
if (fi->fi_type.fb_depth == 8) {
fi->fi_savedcmap = malloc(768, M_DEVBUF, M_NOWAIT);
if (fi->fi_savedcmap == NULL) {
printf("fbopen: no memory for cmap\n");
return (ENOMEM);
}
fi->fi_driver->fbd_getcmap(fi, fi->fi_savedcmap, 0, 256);
}
fi->fi_open = 1;
if (fi->fi_type.fb_depth == 8)
fi->fi_driver->fbd_getcmap(fi, saved_cmap[minor(dev)], 0, 256);
(*fi->fi_driver->fbd_initcmap)(fi);
/*
@ -53,9 +50,10 @@ fbclose(dev, flag, mode, p)
struct fbinfo *fi;
struct pmax_fbtty *fbtty;
if (minor(dev) >= fbcd.cd_ndevs ||
(fi = fbcd.cd_devs[minor(dev)]) == NULL)
if (minor(dev) >= fbndevs)
return(EBADF);
fi = &fbdevs[minor(dev)].fd_info;
if (!fi->fi_open)
return (EBADF);
@ -63,13 +61,13 @@ fbclose(dev, flag, mode, p)
fbtty = fi->fi_glasstty;
fi->fi_open = 0;
if (fi->fi_type.fb_depth == 8)
fi->fi_driver->fbd_putcmap(fi, saved_cmap[minor(dev)], 0, 256);
else
if (fi->fi_type.fb_depth == 8) {
fi->fi_driver->fbd_putcmap(fi, fi->fi_savedcmap, 0, 256);
free(fi->fi_savedcmap, M_DEVBUF);
} else
fi->fi_driver->fbd_initcmap(fi);
genDeconfigMouse();
fbScreenInit(fi);
bzero((caddr_t)fi->fi_pixels, fi->fi_pixelsize);
(*fi->fi_driver->fbd_poscursor)
@ -89,10 +87,10 @@ fbioctl(dev, cmd, data, flag, p)
struct pmax_fbtty *fbtty;
char cmap_buf [3];
if (minor(dev) >= fbcd.cd_ndevs ||
(fi = fbcd.cd_devs[minor(dev)]) == NULL)
if (minor(dev) >= fbndevs)
return(EBADF);
fi = &fbdevs[minor(dev)].fd_info;
fbtty = fi->fi_glasstty;
switch (cmd) {
@ -118,7 +116,6 @@ fbioctl(dev, cmd, data, flag, p)
/*
* Initialize the screen.
*/
fbScreenInit(fi);
break;
case QIOCKPCMD:
@ -225,9 +222,14 @@ fbpoll(dev, events, p)
int events;
struct proc *p;
{
struct fbinfo *fi = fbcd.cd_devs[minor(dev)];
struct fbinfo *fi;
int revents = 0;
if (minor(dev) >= fbndevs)
return(EBADF);
fi = &fbdevs[minor(dev)].fd_info;
if (events & (POLLIN | POLLRDNORM)) {
if (fi->fi_fbu->scrInfo.qe.eHead !=
fi->fi_fbu->scrInfo.qe.eTail)
@ -255,15 +257,16 @@ fbmmap(dev, off, prot)
dev_t dev;
int off, prot;
{
int len;
struct fbinfo *fi;
int len;
if (off < 0)
return (-1);
if (minor(dev) >= fbcd.cd_ndevs ||
(fi = fbcd.cd_devs[minor(dev)]) == NULL)
if (minor(dev) >= fbndevs)
return(-1);
fi = &fbdevs[minor(dev)].fd_info;
len = mips_round_page(((vaddr_t)fi->fi_fbu & PGOFSET)
+ sizeof(*fi->fi_fbu));

View File

@ -1,4 +1,4 @@
/* $NetBSD: findcons.c,v 1.13 1999/06/08 23:42:36 simonb Exp $ */
/* $NetBSD: findcons.c,v 1.14 1999/07/25 22:50:28 ad Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: findcons.c,v 1.13 1999/06/08 23:42:36 simonb Exp $$");
__KERNEL_RCSID(0, "$NetBSD: findcons.c,v 1.14 1999/07/25 22:50:28 ad Exp $$");
#include <sys/param.h>
#include <sys/systm.h>
@ -78,6 +78,7 @@ struct consdev cd;
#include <machine/tc_machdep.h>
#include <pmax/pmax/asic.h> /* scc serial console addresses */
#include <pmax/pmax/kn01.h>
#include <pmax/pmax/kn03.h>
#include <pmax/pmax/kmin.h>
#include <pmax/pmax/maxine.h>
@ -275,9 +276,17 @@ pm_screen(crtslot)
int crtslot;
{
#if NPM > 0
if (pminit(0, 0, 1)) {
struct fbinfo *fi;
caddr_t base;
base = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_PCC);
if (fballoc(base, &fi))
return (1);
if (pminit(fi, base, 0, 1)) {
cd.cn_pri = CN_INTERNAL;
return(1);
return (1);
}
#endif
return (0);
@ -292,11 +301,20 @@ int
xcfb_screen(crtslot)
int crtslot;
{
#if NXCFB > 0
struct fbinfo *fi;
caddr_t base;
#endif
if (systype != DS_MAXINE)
return 0;
#if NXCFB > 0
if (crtslot == 3 && xcfbinit(NULL, NULL, 0, 0)) {
base = (caddr_t)MIPS_PHYS_TO_KSEG1(XINE_PHYS_CFB_START);
if (fballoc(base, &fi))
return (0);
if (crtslot == 3 && xcfbinit(fi, base, 0, 1)) {
cd.cn_pri = CN_INTERNAL;
return(1);
} else

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfb.c,v 1.37 1999/04/24 08:01:05 simonb Exp $ */
/* $NetBSD: mfb.c,v 1.38 1999/07/25 22:50:28 ad Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.37 1999/04/24 08:01:05 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.38 1999/07/25 22:50:28 ad Exp $");
#include "fb.h"
#include "mfb.h"
@ -89,7 +89,6 @@ __KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.37 1999/04/24 08:01:05 simonb Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#include <sys/device.h>
#include <sys/systm.h>
@ -112,20 +111,10 @@ __KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.37 1999/04/24 08:01:05 simonb Exp $");
*/
struct fbuaccess mfbu;
struct pmax_fbtty mfbfb;
struct fbinfo mfbfi; /*XXX*/
/*
* Forward references.
*/
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
void mfbPosCursor __P((struct fbinfo *fi, int x, int y));
int mfbinit __P((struct fbinfo *fi, caddr_t mfbaddr, int unit, int silent));
#if 1 /* these go away when we use the abstracted-out chip drivers */
@ -234,17 +223,13 @@ mfbattach(parent, self, aux)
struct tc_attach_args *ta = aux;
caddr_t mfbaddr = (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(mfbaddr, &fi) == 0 && !mfbinit(fi, mfbaddr, unit, 0))
return;
#ifdef notyet
struct fbinfo *fi = &mfbfi;
/* if this is the console, it's already configured. */
if (ta->ta_cookie == cons_slot)
return; /* XXX patch up softc pointer */
#endif
if (!mfbinit(fi, mfbaddr, unit, 0))
if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
return;
/*
@ -254,6 +239,7 @@ mfbattach(parent, self, aux)
* interrupt handler, which interrupts during vertical-retrace.
*/
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, mfb_intr, fi);
fbconnect("PMAG-AA", fi, 0);
printf("\n");
}
@ -268,26 +254,8 @@ mfbinit(fi, mfbaddr, unit, silent)
int unit;
int silent;
{
int isconsole = 0;
/*
* 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 = &mfbfi; /* XXX */
fi->fi_cmap_bits = (caddr_t)cmap_bits;
isconsole = 1;
}
else {
fi->fi_cmap_bits = malloc(CMAP_BITS, M_DEVBUF, M_NOWAIT);
if (fi->fi_cmap_bits == NULL) {
printf("mfb%d: no memory for cmap\n", unit);
return (0);
}
}
/* check for no frame buffer */
if (badaddr(mfbaddr, 4)) {
printf("mfb: bad address 0x%p\n", mfbaddr);
@ -359,10 +327,6 @@ mfbinit(fi, mfbaddr, unit, silent)
* Connect to the raster-console pseudo-driver.
*/
fbconnect("PMAG-AA", fi, silent);
#ifdef fpinitialized
fp->initialized = 1;
#endif
return (1);
}
@ -614,7 +578,7 @@ mfbLoadColorMap(fi, bits, index, count)
if (count < 0 || index < 0 || index + count > 15)
return EINVAL;
/* We will read COUNT red, green, and blue values from CMAP_BITS. */
/* We will read COUNT red, green, and blue values from cmap_bits */
cmap_bits = (u_char *)bits;
/*
@ -819,9 +783,12 @@ int
mfb_intr(sc)
void *sc;
{
struct fbinfo *fi = (struct fbinfo *)sc;
struct fbinfo *fi;
volatile int junk;
char *slot_addr = (((char *)fi->fi_base) - MFB_OFFSET_BT431);
char *slot_addr;
fi = (struct fbinfo *)sc;
slot_addr = (((char *)fi->fi_base) - MFB_OFFSET_BT431);
/* reset vertical-retrace interrupt by writing a dont-care */
junk = *(volatile int*) (slot_addr + MFB_OFFSET_IREQ);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pm.c,v 1.27 1999/04/24 08:01:05 simonb Exp $ */
/* $NetBSD: pm.c,v 1.28 1999/07/25 22:50:28 ad Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.27 1999/04/24 08:01:05 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.28 1999/07/25 22:50:28 ad Exp $");
#include <sys/param.h>
@ -113,18 +113,12 @@ void pccCursorOn __P((struct fbinfo *fi));
void pccCursorOff __P((struct fbinfo *fi));
void pmInitColorMap __P((struct fbinfo *fi));
int pminit __P((struct fbinfo *fi, int unit, int cold_console_flag));
int pminit __P((struct fbinfo *fi, caddr_t base, int unit, int console));
int pmattach __P((struct fbinfo *fi, int unit, int cold_console_flag));
static int pm_video_on __P ((struct fbinfo *));
static int pm_video_off __P ((struct fbinfo *));
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
/* new-style raster-cons "driver" methods */
struct fbdriver pm_driver = {
@ -184,17 +178,6 @@ pmattach(fi, unit, cold_console_flag)
fi->fi_pixelsize =
((fi->fi_type.fb_depth == 1) ? 1024 / 8 : 1024) * 864;
fi->fi_blanked = 0;
if (cold_console_flag) {
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("pm%d: no memory for cmap\n", unit);
return (0);
}
}
fi->fi_type.fb_width = 1024;
fi->fi_type.fb_height = 864;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pm_ds.c,v 1.9 1999/07/16 14:23:47 ad Exp $ */
/* $NetBSD: pm_ds.c,v 1.10 1999/07/25 22:50:29 ad Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
@ -45,12 +45,9 @@ pm needs dc device
#endif
#endif
extern int pminit __P((struct fbinfo *fi, int unit, int cold_console_flag));
int ds_pm_init __P ((struct fbinfo *fi, int unti, int cold_console_flag));
int pm_ds_match __P((struct device *, struct cfdata *, void *));
void pm_ds_attach __P((struct device *, struct device *, void *));
int ds_pm_init __P ((struct fbinfo *fi, int unti, int cold_console_flag));
int pm_ds_match __P((struct device *, struct cfdata *, void *));
void pm_ds_attach __P((struct device *, struct device *, void *));
/*
* Define decstation pm front-end driver for autoconfig
@ -63,9 +60,6 @@ struct cfattach pm_ds_ca = {
/* XXX pmvar.h */
extern struct fbuacces pmu;
/* static struct for cold console init */
struct fbinfo pmfi; /*XXX*/
/*
* rcons methods and globals.
*/
@ -91,8 +85,12 @@ ds_pm_init (fi, unit, cold_console_flag)
int unit;
int cold_console_flag;
{
caddr_t base;
base = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_PCC);
/* only have one pm, address &c hardcoded in pminit() */
return (pminit(fi, unit, cold_console_flag));
return (pminit(fi, base, unit, cold_console_flag));
}
int
@ -120,10 +118,15 @@ pm_ds_attach(parent, self, aux)
struct device *self;
void *aux;
{
/*struct ibus_attach_args *ia = aux;*/
/*caddr_t pmaddr = (caddr_t)ia->ia_addr;*/
struct ibus_attach_args *ia = aux;
caddr_t base = (caddr_t)ia->ia_addr;
struct fbinfo *fi;
if (!pminit(&pmfi, 0, 0))
/* Allocate a struct fbinfo and point the softc at it */
if (fballoc(base, &fi) == 0 && !pminit(fi, base, 0, 0))
return;
if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
return;
/* no interrupts for PM */
@ -141,25 +144,17 @@ pm_ds_attach(parent, self, aux)
* statically-allocated "softc", and pass to pmattach().
*/
int
pminit(fi, unit, cold_console_flag)
pminit(fi, base, unit, cold_console_flag)
struct fbinfo *fi;
caddr_t base;
int unit;
int cold_console_flag;
{
/*
* If this device is being initialized as the console, malloc()
* is not yet up and we must use statically-allocated space.
*/
if (fi == NULL) {
fi = &pmfi; /* XXX */
}
/* cmap_bits set in MI back-end */
/* Set address of frame buffer... */
fi->fi_unit = unit;
fi->fi_base = base;
fi->fi_pixels = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_PHYS_FBUF_START);
fi->fi_base = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_PCC);
fi->fi_vdac = (caddr_t)MIPS_PHYS_TO_KSEG1(KN01_SYS_VDAC);
/* check for no frame buffer */

View File

@ -1,8 +1,8 @@
/* $NetBSD: pmvar.h,v 1.4 1999/04/24 08:01:05 simonb Exp $ */
/* $NetBSD: pmvar.h,v 1.5 1999/07/25 22:50:29 ad Exp $ */
/*
* Initialize a Decstation 3100/2100 baseboard framebuffer,
* so it can be used as a bitmapped glass-tty console device.
*/
int pminit __P((struct fbinfo *fi, int unit, int silent));
int pminit __P((struct fbinfo *fi, caddr_t base, int unit, int silent));
int pmattach __P((struct fbinfo *fi, int unit, int silent));

View File

@ -1,4 +1,4 @@
/* $NetBSD: px.c,v 1.13 1999/06/22 14:51:58 oster Exp $ */
/* $NetBSD: px.c,v 1.14 1999/07/25 22:50:29 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.13 1999/06/22 14:51:58 oster Exp $");
__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.14 1999/07/25 22:50:29 ad Exp $");
/*
* px.c: driver for the DEC TURBOchannel 2D and 3D accelerated framebuffers
@ -338,10 +338,10 @@ px_attach(parent, self, aux)
* XXX use magic number to make sure fi isn't a real struct fbinfo?
*/
int
px_init(fi, slotbase, unit, silent)
px_init(fi, slotbase, unit, console)
struct fbinfo *fi;
caddr_t slotbase;
int unit, silent;
int unit, console;
{
struct px_info *pxi;
u_long bufpa;
@ -394,7 +394,7 @@ px_init(fi, slotbase, unit, silent)
}
/* Get a font and lock. If we're not the console, we don't care */
if (fi == NULL) {
if (console) {
wsfont_init();
if ((i = wsfont_find(NULL, 0, 0, 2)) <= 0)
@ -416,7 +416,7 @@ px_init(fi, slotbase, unit, silent)
pxi->pxi_fontscale = pxi->pxi_font->fontheight * pxi->pxi_font->stride;
/* Connect to rcons if this is the console device */
if (fi == NULL) {
if (console) {
px_cons_info = pxi;
/* XXX no multiscreen X support yet */

View File

@ -1,4 +1,4 @@
/* $NetBSD: qvss_compat.c,v 1.18 1999/06/22 14:51:58 oster Exp $ */
/* $NetBSD: qvss_compat.c,v 1.19 1999/07/25 22:50:29 ad Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -176,11 +176,13 @@ init_pmaxfbu(fi)
/* A guess, but correct for 1024x864, 1024x768 and 1280x1024 */
tty_rows = (fi->fi_type.fb_height / 15) - 1;
#ifdef notdef
if (tty_rows != fbu->scrInfo.max_row ||
tty_cols != fbu->scrInfo.max_col)
printf("framebuffer init: size mismatch: given %dx%d, compute %dx%d\n",
fbu->scrInfo.max_row, fbu->scrInfo.max_col,
tty_rows, tty_cols);
#endif
pmEventQueueInit(&fi->fi_fbu->scrInfo.qe);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfb.c,v 1.31 1999/05/10 12:36:16 simonb Exp $ */
/* $NetBSD: sfb.c,v 1.32 1999/07/25 22:50:29 ad Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -113,7 +113,6 @@
*/
struct fbuaccess sfbu;
struct pmax_fbtty sfbfb;
struct fbinfo sfbfi; /*XXX*/ /* should be softc */
/*
@ -122,9 +121,6 @@ struct fbinfo sfbfi; /*XXX*/ /* should be softc */
int sfbinit __P((struct fbinfo *fi, caddr_t sfbaddr, int unit, int silent));
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
int sfbmatch __P((struct device *, struct cfdata *, void *));
void sfbattach __P((struct device *, struct device *, void *));
int sfb_intr __P((void *sc));
@ -183,17 +179,15 @@ sfbattach(parent, self, aux)
struct tc_attach_args *ta = aux;
caddr_t sfbaddr = (caddr_t)ta->ta_addr;
int unit = self->dv_unit;
struct fbinfo *fi = (struct fbinfo *) self;
struct fbinfo *fi;
#ifdef notyet
/* if this is the console, it's already configured. */
if (ta->ta_cookie == cons_slot)
return; /* XXX patch up f softc pointer */
#endif
/* Allocate a struct fbinfo and point the softc at it */
if (fballoc(sfbaddr, &fi) == 0 && !sfbinit(fi, sfbaddr, unit, 0))
return;
if (!sfbinit(fi, sfbaddr, unit, 0))
if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
return;
#if 0 /*XXX*/
/*
@ -211,6 +205,7 @@ sfbattach(parent, self, aux)
* interrupt handler, which interrupts during vertical-retrace.
*/
tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, sfb_intr, fi);
fbconnect ("PMAGB-BA", fi, 0);
printf("\n");
}
@ -229,22 +224,6 @@ sfbinit(fi, base, unit, silent)
int h_setup, v_setup;
int x_pixels, y_pixels; /* visible pixel dimensions */
/*
* 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 = &sfbfi; /* 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("sfb%d: no memory for cmap\n", unit);
return (0);
}
}
/* check for no frame buffer */
if (badaddr(base + SFB_OFFSET_VRAM, 4))
return (0);
@ -348,9 +327,12 @@ int
sfb_intr(sc)
void *sc;
{
struct fbinfo *fi = (struct fbinfo *)sc;
char *slot_addr = (((char *)fi->fi_base) - SFB_ASIC_OFFSET);
struct fbinfo *fi;
char *slot_addr;
fi = (struct fbinfo *)sc;
slot_addr = (((char *)fi->fi_base) - SFB_ASIC_OFFSET);
/* reset vertical-retrace interrupt by writing a dont-care */
*(int*) (slot_addr + SFB_CLEAR) = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xcfb.c,v 1.26 1999/04/24 08:01:08 simonb Exp $ */
/* $NetBSD: xcfb.c,v 1.27 1999/07/25 22:50:29 ad Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -133,11 +133,6 @@ struct fbuaccess xcfbu;
*/
struct pmax_fbtty xcfbfb;
struct fbinfo xcfbfi; /*XXX*/
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [CMAP_BITS]; /* colormap for console... */
#define XCFB_FB_SIZE 0x100000 /* size of raster (mapped into userspace) */
@ -194,13 +189,23 @@ xcfbattach(parent, self, aux)
struct device *self;
void *aux;
{
struct tc_attach_args *ta = aux;
struct tc_attach_args *ta;
struct fbinfo *fi;
caddr_t base;
if (!xcfbinit(NULL, (caddr_t)ta->ta_addr, self->dv_unit, 0))
ta = aux;
base = (caddr_t)ta->ta_addr;
/* Allocate a struct fbinfo and point the softc at it */
if (fballoc(base, &fi) == 0 && !xcfbinit(fi, base, self->dv_unit, 0))
return;
if ((((struct fbsoftc *)self)->sc_fi = fi) == NULL)
return;
/* no interrupts for XCFB */
/*BUS_INTR_ESTABLISH(ca, xcfbintr, self->dv_unit);*/
fbconnect("PMAG-DV", fi, 0);
printf("\n");
}
@ -215,29 +220,13 @@ xcfbinit(fi, base, unit, silent)
int unit;
int silent;
{
/*XXX*/
/*
* 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 = &xcfbfi; /* 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);
}
}
/*XXX*/
/*
* Or Cached? A comment in the Mach driver suggests that the X server
* runs faster in cached address space, but the X server is going
* to blow away the data cache whenever it updates the screen, so..
*/
base = (char *) MIPS_PHYS_TO_KSEG1(XINE_PHYS_CFB_START);
/* Fill in main frame buffer info struct. */
fi->fi_unit = unit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fbvar.h,v 1.4 1999/06/21 19:21:10 ad Exp $ */
/* $NetBSD: fbvar.h,v 1.5 1999/07/25 22:50:50 ad Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -58,19 +58,12 @@ struct hw_cursor {
int cmap_size; /* Size of cursor colormap... */
};
#ifdef notyet
/*
* This will shortly become the preferred way to hook-up framebuffers,
* ridding us of the ungainly hack that 'struct fbinfo' currently presents.
*/
struct fbsoftc {
struct device sc_dv;
struct fbinfo *sc_fi;
};
#endif
struct fbinfo {
struct device fi_dv; /* autoconfig device struct */
int fi_unit; /* Physical frame buffer unit. */
struct fbtype fi_type; /* Geometry of frame buffer. */
caddr_t fi_pixels; /* display RAM */
@ -80,6 +73,7 @@ struct fbinfo {
caddr_t fi_cmap_bits; /* Colormap backing store... */
int fi_size; /* Size of entire fb address space. */
int fi_linebytes; /* bytes per display line */
caddr_t fi_savedcmap; /* Colormap before open() */
struct fbdriver *fi_driver; /* pointer to driver */
struct hw_cursor fi_cursor; /* Hardware cursor info */
@ -108,7 +102,12 @@ struct fbdriver {
void (*fbd_cursorcolor) __P ((struct fbinfo *fi, u_int *color));
};
#ifdef _KERNEL
#define kbd_docmd(cmd, val) 0 /* For now, do nothing. */
#define romgetcursoraddr(xp, yp) 0
void fbconnect __P ((char *name, struct fbinfo *info, int silent));
void fbconnect __P ((char *name, struct fbinfo *info, int silent));
int fballoc __P ((caddr_t base, struct fbinfo **fip));
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc_subr.c,v 1.24 1999/06/24 18:47:58 ad Exp $ */
/* $NetBSD: tc_subr.c,v 1.25 1999/07/25 22:50:59 ad Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_subr.c,v 1.24 1999/06/24 18:47:58 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: tc_subr.c,v 1.25 1999/07/25 22:50:59 ad Exp $");
#include <sys/types.h>
@ -336,6 +336,7 @@ tc_consprobeslot(tc_slotaddr)
{
void *slotaddr = (void *) tc_slotaddr;
struct fbinfo *fi;
char name[20];
int i;
@ -349,6 +350,9 @@ tc_consprobeslot(tc_slotaddr)
if (tc_checkslot(tc_slotaddr, name) == 0)
return (0);
if (fballoc((caddr_t)tc_slotaddr, &fi))
return (0);
/*
* We found an device in the given slot. Now see if it's a
* framebuffer for which we have a driver.
@ -357,7 +361,7 @@ tc_consprobeslot(tc_slotaddr)
if (tcfbsw[i].fbsw_initfn == 0)
break;
if (strcmp(name, tcfbsw[i].fbsw_name) == 0) {
if (tcfbsw[i].fbsw_initfn(NULL, slotaddr, 0, 1))
if (tcfbsw[i].fbsw_initfn(fi, slotaddr, 0, 1))
return (1);
}
}