Added support for the PowerStorm 4d20, initial support that is.

I plan on cleaning a few things up over the next few days, but this
appears to be working for me.
This commit is contained in:
elric 2001-12-12 07:50:05 +00:00
parent 94448f7e52
commit 51b292ea65
4 changed files with 105 additions and 40 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.pci,v 1.150 2001/12/05 15:51:11 augustss Exp $
# $NetBSD: files.pci,v 1.151 2001/12/12 07:50:05 elric Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@ -221,6 +221,7 @@ file dev/pci/tga.c tga needs-flag
file dev/pci/tga_conf.c tga
file dev/ic/bt485.c tga
file dev/ic/bt463.c tga
file dev/ic/ibm561.c tga
# Brooktree Bt848 video capture
device bktr: pcibus

View File

@ -1,4 +1,4 @@
/* $NetBSD: tga.c,v 1.37 2001/11/13 07:48:49 lukem Exp $ */
/* $NetBSD: tga.c,v 1.38 2001/12/12 07:50:05 elric Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.37 2001/11/13 07:48:49 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.38 2001/12/12 07:50:05 elric Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.37 2001/11/13 07:48:49 lukem Exp $");
#include <dev/ic/bt485var.h>
#include <dev/ic/bt463reg.h>
#include <dev/ic/bt463var.h>
#include <dev/ic/ibm561var.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wscons_raster.h>
@ -81,6 +82,7 @@ static void tga_init __P((bus_space_tag_t memt, pci_chipset_tag_t pc,
static int tga_matchcommon __P((bus_space_tag_t, pci_chipset_tag_t, pcitag_t));
static void tga_mapaddrs __P((bus_space_tag_t memt, pci_chipset_tag_t pc,
pcitag_t, bus_size_t *pcisize, struct tga_devconfig *dc));
unsigned tga_getdotclock __P((struct tga_devconfig *dc));
struct tga_devconfig tga_console_dc;
@ -101,7 +103,7 @@ static void tga_putchar __P((void *c, int row, int col,
u_int uc, long attr));
static void tga_eraserows __P((void *, int, int, long));
static void tga_erasecols __P((void *, int, int, int, long));
void tga2_init __P((struct tga_devconfig *, int));
void tga2_init __P((struct tga_devconfig *));
static void tga_config_interrupts __P((struct device *));
@ -289,12 +291,8 @@ tga_init(memt, pc, tag, dc)
panic("tga_init: TGA Revision not recognized");
}
if (dc->dc_tga2) {
int monitor;
monitor = (~TGARREG(dc, TGA_REG_GREV) >> 16) & 0x0f;
tga2_init(dc, monitor);
}
if (dc->dc_tga2)
tga2_init(dc);
switch (TGARREG(dc, TGA_REG_VHCR) & 0x1ff) { /* XXX */
case 0:
@ -489,11 +487,18 @@ tgaattach(parent, self, aux)
sc->sc_dc->dc_ramdac_cookie =
sc->sc_dc->dc_ramdac_funcs->ramdac_register(sc->sc_dc,
tga_sched_update, tga2_ramdac_wr, tga2_ramdac_rd);
/* XXX this is a bit of a hack, setting the dotclock here */
if (sc->sc_dc->dc_tgaconf->ramdac_funcs != bt485_funcs)
(*sc->sc_dc->dc_ramdac_funcs->ramdac_set_dotclock)
(sc->sc_dc->dc_ramdac_cookie,
tga_getdotclock(sc->sc_dc));
}
/*
* Initialize the RAMDAC. Initialization includes disabling
* cursor, setting a sane colormap, etc.
* cursor, setting a sane colormap, etc. We presume that we've
* filled in the necessary dot clock for PowerStorm 4d20.
*/
(*sc->sc_dc->dc_ramdac_funcs->ramdac_init)(sc->sc_dc->dc_ramdac_cookie);
TGAWREG(sc->sc_dc, TGA_REG_SISR, 0x00000001); /* XXX */
@ -553,7 +558,11 @@ tga_ioctl(v, cmd, data, flag, p)
wsd_fbip->height = sc->sc_dc->dc_ht;
wsd_fbip->width = sc->sc_dc->dc_wid;
wsd_fbip->depth = sc->sc_dc->dc_tgaconf->tgac_phys_depth;
#if 0
wsd_fbip->cmsize = 256; /* XXX ??? */
#else
wsd_fbip->cmsize = 1024; /* XXX ??? */
#endif
#undef wsd_fbip
return (0);
@ -748,10 +757,14 @@ tga_cnattach(iot, memt, pc, bus, device, function)
* Initialization includes disabling cursor, setting a sane
* colormap, etc. It will be reinitialized in tgaattach().
*/
if (dcp->dc_tga2)
bt485_cninit(dcp, tga_sched_update, tga2_ramdac_wr,
tga2_ramdac_rd);
else {
if (dcp->dc_tga2) {
if (dcp->dc_tgaconf->ramdac_funcs == bt485_funcs)
bt485_cninit(dcp, tga_sched_update, tga2_ramdac_wr,
tga2_ramdac_rd);
else
ibm561_cninit(dcp, tga_sched_update, tga2_ramdac_wr,
tga2_ramdac_rd, tga_getdotclock(dcp));
} else {
if (dcp->dc_tgaconf->ramdac_funcs == bt485_funcs)
bt485_cninit(dcp, tga_sched_update, tga_ramdac_wr,
tga_ramdac_rd);
@ -1502,31 +1515,46 @@ void tga2_ics9110_wr __P((
int dotclock
));
void
tga2_init(dc, m)
struct tga_devconfig *dc;
int m;
{
struct monitor *tga_getmonitor __P((struct tga_devconfig *dc));
tga2_ics9110_wr(dc, decmonitors[m].dotclock);
void
tga2_init(dc)
struct tga_devconfig *dc;
{
struct monitor *m = tga_getmonitor(dc);
/* Deal with the dot clocks.
*/
if (dc->dc_tga_type == TGA_TYPE_POWERSTORM_4D20) {
/* Set this up as a reference clock for the
* ibm561's PLL.
*/
tga2_ics9110_wr(dc, 14300000);
/* XXX Can't set up the dotclock properly, until such time
* as the RAMDAC is configured.
*/
} else {
/* otherwise the ics9110 is our clock. */
tga2_ics9110_wr(dc, m->dotclock);
}
#if 0
TGAWREG(dc, TGA_REG_VHCR,
((decmonitors[m].hbp / 4) << 21) |
((decmonitors[m].hsync / 4) << 14) |
(((decmonitors[m].hfp - 4) / 4) << 9) |
((decmonitors[m].cols + 4) / 4));
((m->hbp / 4) << 21) |
((m->hsync / 4) << 14) |
(((m->hfp - 4) / 4) << 9) |
((m->cols + 4) / 4));
#else
TGAWREG(dc, TGA_REG_VHCR,
((decmonitors[m].hbp / 4) << 21) |
((decmonitors[m].hsync / 4) << 14) |
(((decmonitors[m].hfp) / 4) << 9) |
((decmonitors[m].cols) / 4));
((m->hbp / 4) << 21) |
((m->hsync / 4) << 14) |
(((m->hfp) / 4) << 9) |
((m->cols) / 4));
#endif
TGAWREG(dc, TGA_REG_VVCR,
(decmonitors[m].vbp << 22) |
(decmonitors[m].vsync << 16) |
(decmonitors[m].vfp << 11) |
(decmonitors[m].rows));
(m->vbp << 22) |
(m->vsync << 16) |
(m->vfp << 11) |
(m->rows));
TGAWREG(dc, TGA_REG_VVBR, 1);
TGAREGRWB(dc, TGA_REG_VHCR, 3);
TGAWREG(dc, TGA_REG_VVVR, TGARREG(dc, TGA_REG_VVVR) | 1);
@ -1578,6 +1606,8 @@ tga2_ics9110_wr(dc, dotclock)
N = 0x60; M = 0x32; V = 0x1; X = 0x1; R = 0x2; break;
case 202500000:
N = 0x60; M = 0x32; V = 0x1; X = 0x1; R = 0x2; break;
case 14300000: /* this one is just a ref clock */
N = 0x03; M = 0x03; V = 0x1; X = 0x1; R = 0x3; break;
default:
panic("unrecognized clock rate %d\n", dotclock);
}
@ -1606,3 +1636,17 @@ tga2_ics9110_wr(dc, dotclock)
bus_space_write_4(dc->dc_memt, clock, 0, 0x0);
bus_space_barrier(dc->dc_memt, clock, 0, 0, BUS_SPACE_BARRIER_WRITE);
}
struct monitor *
tga_getmonitor(dc)
struct tga_devconfig *dc;
{
return &decmonitors[(~TGARREG(dc, TGA_REG_GREV) >> 16) & 0x0f];
}
unsigned
tga_getdotclock(dc)
struct tga_devconfig *dc;
{
return tga_getmonitor(dc)->dotclock;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tga_conf.c,v 1.5 2001/11/13 07:48:49 lukem Exp $ */
/* $NetBSD: tga_conf.c,v 1.6 2001/12/12 07:50:05 elric Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,9 +28,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tga_conf.c,v 1.5 2001/11/13 07:48:49 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: tga_conf.c,v 1.6 2001/12/12 07:50:05 elric Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <dev/pci/pcivar.h>
@ -39,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: tga_conf.c,v 1.5 2001/11/13 07:48:49 lukem Exp $");
#include <dev/ic/bt485var.h>
#include <dev/ic/bt463var.h>
#include <dev/ic/ibm561var.h>
#undef KB
#define KB * 1024
@ -116,6 +118,17 @@ static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = {
1, { 16 MB, 0 }, { 8 MB, 0 },
1, { 24 MB, 0 }, { 8 MB, 0 },
},
/* TGA_TYPE_POWERSTORM_4D20 */
/* XXX: These numbers may be incorrect */
{
"PS4d20",
ibm561_funcs,
32,
32 MB,
16 KB,
1, { 16 MB, 0 }, { 8 MB, 0 },
1, { 24 MB, 0 }, { 8 MB, 0 },
}
};
#undef KB
@ -127,14 +140,17 @@ tga_identify(dc)
{
int type;
int gder;
int grev;
int deep, addrmask, wide;
int tga2;
gder = TGARREG(dc, TGA_REG_GDER);
grev = TGARREG(dc, TGA_REG_GREV);
deep = (gder & 0x1) != 0; /* XXX */
addrmask = (gder >> 2) & 0x7; /* XXX */
wide = (gder & 0x200) == 0; /* XXX */
tga2 = (grev & 0x20) != 0;
type = TGA_TYPE_UNKNOWN;
@ -161,6 +177,10 @@ tga_identify(dc)
}
} else {
/* 32bpp frame buffer */
if (addrmask == 0x00 && tga2 && wide) {
/* My PowerStorm 4d20 shows up this way? */
type = TGA_TYPE_POWERSTORM_4D20;
}
if (addrmask == 0x3) {
/* 16MB core map; T32-04 or T32-08 */
@ -172,7 +192,7 @@ tga_identify(dc)
} else if (addrmask == 0x7) {
/* 32MB core map; T32-88 */
if (wide) /* sanity */
if (wide && !tga2) /* sanity */
type = TGA_TYPE_T32_88;
}
}
@ -190,4 +210,3 @@ tga_getconf(type)
return (NULL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tgavar.h,v 1.11 2001/09/04 06:59:11 thorpej Exp $ */
/* $NetBSD: tgavar.h,v 1.12 2001/12/12 07:50:05 elric Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -109,7 +109,8 @@ struct tga_softc {
#define TGA_TYPE_T32_04 4 /* 32bpp, 4MB */
#define TGA_TYPE_T32_08 5 /* 32bpp, 8MB */
#define TGA_TYPE_T32_88 6 /* 32bpp, 16MB */
#define TGA_TYPE_UNKNOWN 7 /* unknown */
#define TGA_TYPE_POWERSTORM_4D20 7 /* unknown */
#define TGA_TYPE_UNKNOWN 8 /* unknown */
#define DEVICE_IS_TGA(class, id) \
(((PCI_VENDOR(id) == PCI_VENDOR_DEC && \