8 static void tnt2_getvmode(void *priv);
10 static struct fbdevice tnt2_fb = {
11 .getvmode = &tnt2_getvmode,
14 static unsigned int vgard(unsigned char a)
17 return (unsigned int)inb(0x3D5);
20 static void tnt2_getvmode(void *priv)
22 tnt2_fb.curmode.xres = (vgard(0x1) + 1) * 8;
23 tnt2_fb.curmode.yres = (vgard(0x12) | (vgard(0x7) & 2) << 7 | (vgard(0x7) & 0x40) << 3) + 1;
27 tnt2_fb.curmode.format = FB_RGB888;
28 tnt2_fb.curmode.bytestride = 4;
29 tnt2_fb.curmode.text = 0;
32 tnt2_fb.curmode.text = 1;
35 tnt2_fb.curmode.text = 1;
36 outputf("Unknown TNT2 format %x", vgard(0x28));
41 static int tnt2_probe(struct pci_dev *pci, void *data)
45 if (pci->bars[1].type != PCI_BAR_MEMORY32)
47 output("TNT2 BAR1 is not memory32?");
51 /* Map 32M of memory. */
52 for (p = 0; p < 32; p += 4)
53 addmap_4m(0x40000000 + p*1024*1024, pci->bars[1].addr + p*1024*1024);
54 tnt2_fb.fbaddr = (void *)0x40000000;
57 outputf("Found TNT2 with FB at %08x, mapped to %08x", pci->bars[1].addr, tnt2_fb.fbaddr);
61 static struct pci_id tnt2_pci[] = {
62 {0x10DE, 0x0028, "TNT2", "RIVA TNT2"}
65 struct pci_driver tnt2_driver = {
69 .id_count = sizeof(tnt2_pci)/sizeof(tnt2_pci[0]),