Code from Jason to better configure /dev/fb.
This commit is contained in:
parent
36cd716562
commit
e9a919b88f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bwtwo.c,v 1.16 1995/10/23 23:35:03 pk Exp $ */
|
||||
/* $NetBSD: bwtwo.c,v 1.17 1995/11/29 01:45:36 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -153,6 +153,7 @@ bwtwoattach(parent, self, args)
|
|||
sc->sc_fb.fb_driver = &bwtwofbdriver;
|
||||
sc->sc_fb.fb_device = &sc->sc_dev;
|
||||
sc->sc_fb.fb_type.fb_type = FBTYPE_SUN2BW;
|
||||
sc->sc_fb.fb_flags = sc->sc_dev.dv_cfdata->cf_flags;
|
||||
|
||||
switch (ca->ca_bustype) {
|
||||
case BUS_OBIO:
|
||||
|
@ -232,12 +233,8 @@ bwtwoattach(parent, self, args)
|
|||
if (sbus)
|
||||
sbus_establish(&sc->sc_sd, &sc->sc_dev);
|
||||
#endif
|
||||
/*
|
||||
* XXX: this could cause a panic in fb_attach() if more
|
||||
* than one frame buffer device is found on a Sun 4.
|
||||
*/
|
||||
if (node == fbnode || cputyp == CPU_SUN4)
|
||||
fb_attach(&sc->sc_fb);
|
||||
fb_attach(&sc->sc_fb, isconsole);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cgsix.c,v 1.16 1995/10/08 01:39:16 pk Exp $ */
|
||||
/* $NetBSD: cgsix.c,v 1.17 1995/11/29 01:45:47 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
|
@ -177,13 +177,14 @@ cgsixattach(parent, self, args)
|
|||
register int node, ramsize, i;
|
||||
register volatile struct bt_regs *bt;
|
||||
register volatile struct cg6_layout *p;
|
||||
int sbus = 1;
|
||||
int isconsole, sbus = 1;
|
||||
char *nam;
|
||||
extern struct tty *fbconstty;
|
||||
|
||||
sc->sc_fb.fb_driver = &cg6_fbdriver;
|
||||
sc->sc_fb.fb_device = &sc->sc_dev;
|
||||
sc->sc_fb.fb_type.fb_type = FBTYPE_SUNFAST_COLOR;
|
||||
sc->sc_fb.fb_flags = sc->sc_dev.dv_cfdata->cf_flags;
|
||||
|
||||
switch (ca->ca_bustype) {
|
||||
case BUS_OBIO:
|
||||
|
@ -203,6 +204,8 @@ cgsixattach(parent, self, args)
|
|||
return;
|
||||
}
|
||||
|
||||
isconsole = node == fbnode && fbconstty != NULL;
|
||||
|
||||
sc->sc_fb.fb_type.fb_depth = 8;
|
||||
fb_setsize(&sc->sc_fb, sc->sc_fb.fb_type.fb_depth,
|
||||
1152, 900, node, ca->ca_bustype);
|
||||
|
@ -247,14 +250,20 @@ cgsixattach(parent, self, args)
|
|||
/* enable video */
|
||||
sc->sc_thc->thc_misc |= THC_MISC_VIDEN;
|
||||
|
||||
if (node == fbnode && fbconstty != NULL) {
|
||||
if (isconsole) {
|
||||
printf(" (console)\n");
|
||||
#ifdef RASTERCONSOLE
|
||||
sc->sc_fb.fb_pixels = (caddr_t)
|
||||
mapiodev((caddr_t)p->cg6_ram, sizeof(p->cg6_ram),
|
||||
ca->ca_bustype);
|
||||
fbrcons_init(&sc->sc_fb);
|
||||
#endif
|
||||
} else
|
||||
printf("\n");
|
||||
if (sbus)
|
||||
sbus_establish(&sc->sc_sd, &sc->sc_dev);
|
||||
if (node == fbnode)
|
||||
fb_attach(&sc->sc_fb);
|
||||
fb_attach(&sc->sc_fb, isconsole);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cgthree.c,v 1.16 1995/10/08 01:39:18 pk Exp $ */
|
||||
/* $NetBSD: cgthree.c,v 1.17 1995/11/29 01:45:40 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -149,6 +149,7 @@ cgthreeattach(parent, self, args)
|
|||
|
||||
sc->sc_fb.fb_driver = &cgthreefbdriver;
|
||||
sc->sc_fb.fb_device = &sc->sc_dev;
|
||||
sc->sc_fb.fb_flags = sc->sc_dev.dv_cfdata->cf_flags;
|
||||
/*
|
||||
* The defaults below match my screen, but are not guaranteed
|
||||
* to be correct as defaults go...
|
||||
|
@ -215,7 +216,7 @@ cgthreeattach(parent, self, args)
|
|||
if (sbus)
|
||||
sbus_establish(&sc->sc_sd, &sc->sc_dev);
|
||||
if (node == fbnode)
|
||||
fb_attach(&sc->sc_fb);
|
||||
fb_attach(&sc->sc_fb, isconsole);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cgtwo.c,v 1.6 1995/10/28 23:15:16 pk Exp $ */
|
||||
/* $NetBSD: cgtwo.c,v 1.7 1995/11/29 01:45:44 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -71,12 +71,10 @@
|
|||
#endif
|
||||
|
||||
#include <machine/cgtworeg.h>
|
||||
#include <sparc/dev/sbusvar.h>
|
||||
|
||||
/* per-display variables */
|
||||
struct cgtwo_softc {
|
||||
struct device sc_dev; /* base device */
|
||||
struct sbusdev sc_sd; /* sbus device */
|
||||
struct fbdevice sc_fb; /* frame buffer device */
|
||||
caddr_t sc_phys; /* display RAM (phys addr) */
|
||||
volatile struct cg2statusreg *sc_reg; /* CG2 control registers */
|
||||
|
@ -158,16 +156,16 @@ cgtwoattach(parent, self, args)
|
|||
register int node, i;
|
||||
register struct cgtwo_all *p;
|
||||
int isconsole;
|
||||
int sbus = 1;
|
||||
char *nam;
|
||||
|
||||
sc->sc_fb.fb_driver = &cgtwofbdriver;
|
||||
sc->sc_fb.fb_device = &sc->sc_dev;
|
||||
sc->sc_fb.fb_type.fb_type = FBTYPE_SUN2COLOR;
|
||||
sc->sc_fb.fb_flags = sc->sc_dev.dv_cfdata->cf_flags;
|
||||
|
||||
switch (ca->ca_bustype) {
|
||||
case BUS_VME16:
|
||||
sbus = node = 0;
|
||||
node = 0;
|
||||
nam = "cgtwo";
|
||||
break;
|
||||
|
||||
|
@ -203,10 +201,6 @@ cgtwoattach(parent, self, args)
|
|||
else
|
||||
isconsole = 0;
|
||||
}
|
||||
#endif
|
||||
#if defined(SUN4C) || defined(SUN4M)
|
||||
if (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M)
|
||||
isconsole = node == fbnode && fbconstty != NULL;
|
||||
#endif
|
||||
sc->sc_phys = (caddr_t)ca->ca_ra.ra_paddr;
|
||||
if ((sc->sc_fb.fb_pixels = ca->ca_ra.ra_vaddr) == NULL && isconsole) {
|
||||
|
@ -236,10 +230,8 @@ cgtwoattach(parent, self, args)
|
|||
#endif
|
||||
} else
|
||||
printf("\n");
|
||||
if (sbus)
|
||||
sbus_establish(&sc->sc_sd, &sc->sc_dev);
|
||||
if (node == fbnode)
|
||||
fb_attach(&sc->sc_fb);
|
||||
if (node == fbnode || cputyp == CPU_SUN4)
|
||||
fb_attach(&sc->sc_fb, isconsole);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fb.c,v 1.11 1995/10/08 01:39:19 pk Exp $ */
|
||||
/* $NetBSD: fb.c,v 1.12 1995/11/29 01:45:50 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -72,12 +72,71 @@ fb_unblank()
|
|||
}
|
||||
|
||||
void
|
||||
fb_attach(fb)
|
||||
fb_attach(fb, isconsole)
|
||||
struct fbdevice *fb;
|
||||
int isconsole;
|
||||
{
|
||||
static int no_replace, seen_force;
|
||||
|
||||
if (devfb) panic("multiple /dev/fb declarers");
|
||||
/*
|
||||
* We've already had a framebuffer forced into /dev/fb. Don't
|
||||
* allow any more, even if this is the console.
|
||||
*/
|
||||
if (seen_force) {
|
||||
if (devfb) { /* sanity */
|
||||
printf("%s: /dev/fb already full\n",
|
||||
fb->fb_device->dv_xname);
|
||||
return;
|
||||
} else
|
||||
seen_force = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if we're being forced into /dev/fb.
|
||||
*/
|
||||
if (fb->fb_flags & FB_FORCE) {
|
||||
if (devfb)
|
||||
printf("%s: forcefully replaced %s\n",
|
||||
fb->fb_device->dv_xname,
|
||||
devfb->fb_device->dv_xname);
|
||||
devfb = fb;
|
||||
seen_force = no_replace = 1;
|
||||
goto attached;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if we're the console. If we are, then replace
|
||||
* any currently existing framebuffer.
|
||||
*/
|
||||
if (isconsole) {
|
||||
if (devfb)
|
||||
printf("%s: replaced %s\n", fb->fb_device->dv_xname,
|
||||
devfb->fb_device->dv_xname);
|
||||
devfb = fb;
|
||||
no_replace = 1;
|
||||
goto attached;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the final case, we check to see if we can replace an
|
||||
* existing framebuffer, if not, say so and return.
|
||||
*/
|
||||
if (no_replace) {
|
||||
if (devfb) { /* sanity */
|
||||
printf("%s: /dev/fb already full\n",
|
||||
fb->fb_device->dv_xname);
|
||||
return;
|
||||
} else
|
||||
no_replace = 0;
|
||||
}
|
||||
|
||||
if (devfb)
|
||||
printf("%s: replaced %d\n", fb->fb_device->dv_xname,
|
||||
devfb->fb_device->dv_xname);
|
||||
devfb = fb;
|
||||
|
||||
attached:
|
||||
printf("%s: attached to /dev/fb\n", devfb->fb_device->dv_xname);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fbvar.h,v 1.5 1995/10/08 01:40:25 pk Exp $ */
|
||||
/* $NetBSD: fbvar.h,v 1.6 1995/11/29 01:46:26 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -76,13 +76,16 @@ struct fbdevice {
|
|||
struct fbdriver *fb_driver; /* pointer to driver */
|
||||
struct device *fb_device; /* parameter for fbd_unblank */
|
||||
|
||||
int fb_flags; /* flags from config */
|
||||
#define FB_FORCE 0x00000001 /* force device into /dev/fb */
|
||||
|
||||
#ifdef RASTERCONSOLE
|
||||
/* Raster console emulator state */
|
||||
struct rconsole fb_rcons;
|
||||
#endif
|
||||
};
|
||||
|
||||
void fbattach __P((struct fbdevice *));
|
||||
void fb_attach __P((struct fbdevice *, int));
|
||||
void fb_setsize __P((struct fbdevice *, int, int, int, int, int));
|
||||
#ifdef RASTERCONSOLE
|
||||
void fbrcons_init __P((struct fbdevice *));
|
||||
|
|
Loading…
Reference in New Issue