]> Joshua Wise's Git repositories - netwatch.git/blobdiff - video/tnt2.c
latest
[netwatch.git] / video / tnt2.c
index 73a3d0b6eafd484a61f5a68a9a0a4d7febc8ca97..32e646a407989ecd17ed35739de95d5f0502d0d4 100644 (file)
@@ -3,6 +3,7 @@
 #include <pci.h>
 #include <output.h>
 #include <fb.h>
+#include <paging.h>
 
 static void tnt2_getvmode(void *priv);
 
@@ -12,7 +13,7 @@ static struct fbdevice tnt2_fb = {
 
 static unsigned int vgard(unsigned char a)
 {
-       outb(a, 0x3D4);
+       outb(0x3D4, a);
        return (unsigned int)inb(0x3D5);
 }
 
@@ -22,7 +23,7 @@ static void tnt2_getvmode(void *priv)
        tnt2_fb.curmode.yres = (vgard(0x12) | (vgard(0x7) & 2) << 7 | (vgard(0x7) & 0x40) << 3) + 1;
        switch (vgard(0x28))
        {
-       case 4:
+       case 3:
                tnt2_fb.curmode.format = FB_RGB888;
                tnt2_fb.curmode.bytestride = 4;
                tnt2_fb.curmode.text = 0;
@@ -31,21 +32,29 @@ static void tnt2_getvmode(void *priv)
                tnt2_fb.curmode.text = 1;
                break;
        default:
-               outputf("Unknown TNT2 format %d", vgard(0x28));
+               tnt2_fb.curmode.text = 1;
+               outputf("Unknown TNT2 format %x", vgard(0x28));
                break;
        }
 }
 
 static int tnt2_probe(struct pci_dev *pci, void *data)
 {
+       unsigned int p;
+
        if (pci->bars[1].type != PCI_BAR_MEMORY32)
        {
                output("TNT2 BAR1 is not memory32?");
                return 0;
        }
-       tnt2_fb.fbaddr = (void *)pci->bars[1].addr;
+       
+       /* Map 32M of memory. */
+       for (p = 0; p < 32; p += 4)
+               addmap_4m(0x40000000 + p*1024*1024, pci->bars[1].addr + p*1024*1024);
+       tnt2_fb.fbaddr = (void *)0x40000000;
+       
        fb = &tnt2_fb;
-       outputf("Found TNT2 with FB at %08x", tnt2_fb.fbaddr);
+       outputf("Found TNT2 with FB at %08x, mapped to %08x", pci->bars[1].addr, tnt2_fb.fbaddr);
        return 1;
 }
 
This page took 0.02135 seconds and 4 git commands to generate.