Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Added support for the PowerStorm 4d20, initial s...
details: https://anonhg.NetBSD.org/src/rev/5e3f13205c9d
branches: trunk
changeset: 519157:5e3f13205c9d
user: elric <elric%NetBSD.org@localhost>
date: Wed Dec 12 07:50:05 2001 +0000
description:
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.
diffstat:
sys/dev/pci/files.pci | 3 +-
sys/dev/pci/tga.c | 102 +++++++++++++++++++++++++++++++++++-------------
sys/dev/pci/tga_conf.c | 29 +++++++++++--
sys/dev/pci/tgavar.h | 5 +-
4 files changed, 102 insertions(+), 37 deletions(-)
diffs (truncated from 325 to 300 lines):
diff -r 3b90f9567fa4 -r 5e3f13205c9d sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Wed Dec 12 07:47:46 2001 +0000
+++ b/sys/dev/pci/files.pci Wed Dec 12 07:50:05 2001 +0000
@@ -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_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
diff -r 3b90f9567fa4 -r 5e3f13205c9d sys/dev/pci/tga.c
--- a/sys/dev/pci/tga.c Wed Dec 12 07:47:46 2001 +0000
+++ b/sys/dev/pci/tga.c Wed Dec 12 07:50:05 2001 +0000
@@ -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 @@
#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 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 @@
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 @@
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 @@
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 @@
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 @@
* 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 @@
int dotclock
));
+struct monitor *tga_getmonitor __P((struct tga_devconfig *dc));
+
void
-tga2_init(dc, m)
+tga2_init(dc)
struct tga_devconfig *dc;
- int m;
{
+ struct monitor *m = tga_getmonitor(dc);
- tga2_ics9110_wr(dc, decmonitors[m].dotclock);
+ /* 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 @@
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 @@
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;
+}
diff -r 3b90f9567fa4 -r 5e3f13205c9d sys/dev/pci/tga_conf.c
--- a/sys/dev/pci/tga_conf.c Wed Dec 12 07:47:46 2001 +0000
+++ b/sys/dev/pci/tga_conf.c Wed Dec 12 07:50:05 2001 +0000
@@ -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 @@
#include <dev/ic/bt485var.h>
#include <dev/ic/bt463var.h>
+#include <dev/ic/ibm561var.h>
#undef KB
#define KB * 1024
@@ -116,6 +118,17 @@
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 @@
{
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 @@
}
} 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 @@
} else if (addrmask == 0x7) {
/* 32MB core map; T32-88 */
- if (wide) /* sanity */
+ if (wide && !tga2) /* sanity */
type = TGA_TYPE_T32_88;
}
Home |
Main Index |
Thread Index |
Old Index