Re: rivafb on 12" pbook
On Tue, Feb 03, 2004 at 11:45:26PM +0100, Guido Guenther wrote:
> Here's a first patch to kill the whole chip_id table (with a minor
> tradeoff that info->fix.id from now on only contains the NV_ARCH name
> not the exact card name [1]). It also cleans up and fixes the NV_ARCH
Attached is a minor update that adds a tiny bit more information to the
fix.id field. We don't but all NV{1,2}x cards in the same class but also
set the x.
-- Guido
diff -ub --exclude='*.swp' --exclude='*.agx' --exclude='*.cmd' --exclude='*.o' -Naur ../benh-rsync-2.6-clean/drivers/video/riva/fbdev.c drivers/video/riva/fbdev.c
--- ../benh-rsync-2.6-clean/drivers/video/riva/fbdev.c 2003-12-24 08:30:11.000000000 +0100
+++ drivers/video/riva/fbdev.c 2004-02-03 23:21:32.000000000 +0100
@@ -151,53 +151,6 @@
CH_QUADRO4_700XGL
};
-/* directly indexed by riva_chips enum, above */
-static struct riva_chip_info {
- const char *name;
- unsigned arch_rev;
-} riva_chip_info[] __initdata = {
- { "RIVA-128", NV_ARCH_03 },
- { "RIVA-TNT", NV_ARCH_04 },
- { "RIVA-TNT2", NV_ARCH_04 },
- { "RIVA-UTNT2", NV_ARCH_04 },
- { "RIVA-VTNT2", NV_ARCH_04 },
- { "RIVA-UVTNT2", NV_ARCH_04 },
- { "RIVA-ITNT2", NV_ARCH_04 },
- { "GeForce-SDR", NV_ARCH_10 },
- { "GeForce-DDR", NV_ARCH_10 },
- { "Quadro", NV_ARCH_10 },
- { "GeForce2-MX", NV_ARCH_10 },
- { "GeForce2-MX", NV_ARCH_10 },
- { "GeForce2-GO", NV_ARCH_10 },
- { "Quadro2-MXR", NV_ARCH_10 },
- { "GeForce2-GTS", NV_ARCH_10 },
- { "GeForce2-GTS", NV_ARCH_10 },
- { "GeForce2-ULTRA", NV_ARCH_10 },
- { "Quadro2-PRO", NV_ARCH_10 },
- { "GeForce4-MX-460", NV_ARCH_20 },
- { "GeForce4-MX-440", NV_ARCH_20 },
- { "GeForce4-MX-420", NV_ARCH_20 },
- { "GeForce4-440-GO", NV_ARCH_20 },
- { "GeForce4-420-GO", NV_ARCH_20 },
- { "GeForce4-420-GO-M32", NV_ARCH_20 },
- { "Quadro4-500-XGL", NV_ARCH_20 },
- { "GeForce4-440-GO-M64", NV_ARCH_20 },
- { "Quadro4-200", NV_ARCH_20 },
- { "Quadro4-550-XGL", NV_ARCH_20 },
- { "Quadro4-500-GOGL", NV_ARCH_20 },
- { "GeForce2", NV_ARCH_20 },
- { "GeForce3", NV_ARCH_20 },
- { "GeForce3 Ti 200", NV_ARCH_20 },
- { "GeForce3 Ti 500", NV_ARCH_20 },
- { "Quadro DDC", NV_ARCH_20 },
- { "GeForce4 Ti 4600", NV_ARCH_20 },
- { "GeForce4 Ti 4400", NV_ARCH_20 },
- { "GeForce4 Ti 4200", NV_ARCH_20 },
- { "Quadro4-900-XGL", NV_ARCH_20 },
- { "Quadro4-750-XGL", NV_ARCH_20 },
- { "Quadro4-700-XGL", NV_ARCH_20 }
-};
-
static struct pci_device_id rivafb_pci_tbl[] = {
{ PCI_VENDOR_ID_NVIDIA_SGS, PCI_DEVICE_ID_NVIDIA_SGS_RIVA128,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_RIVA_128 },
@@ -301,7 +254,6 @@
#endif
static struct fb_fix_screeninfo rivafb_fix = {
- .id = "nVidia",
.type = FB_TYPE_PACKED_PIXELS,
.xpanstep = 1,
.ypanstep = 1,
@@ -696,7 +648,7 @@
* Saves current chip state to @regs.
*
* CALLED FROM:
- * rivafb_probe()
+ * rivafb_open()
*/
/* from GGI */
static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
@@ -1835,6 +1791,44 @@
par->FlatPanel = 1;
}
+static U032 riva_get_arch(struct pci_dev *pd)
+{
+ U032 arch=0;
+
+ switch (pd->device & 0x0ff0) {
+ case 0x0100: /* GeForce 256 */
+ case 0x0110: /* GeForce2 MX */
+ case 0x0150: /* GeForce2 */
+ case 0x0170: /* GeForce4 MX */
+ case 0x0180: /* GeForce4 MX (8x AGP) */
+ case 0x01A0: /* nForce */
+ case 0x01F0: /* nForce2 */
+ arch = NV_ARCH_10;
+ break;
+ case 0x0200: /* GeForce3 */
+ case 0x0250: /* GeForce4 Ti */
+ case 0x0280: /* GeForce4 Ti (8x AGP) */
+ arch = NV_ARCH_20;
+ break;
+ case 0x0300: /* GeForceFX 5800 */
+ case 0x0310: /* GeForceFX 5600 */
+ case 0x0320: /* GeForceFX 5200 */
+ case 0x0330: /* GeForceFX 5900 */
+ case 0x0340: /* GeForceFX 5700 */
+ arch = NV_ARCH_30;
+ break;
+ case 0x0020: /* TNT, TNT2 */
+ arch = NV_ARCH_04;
+ break;
+ case 0x0010: /* Riva128 */
+ arch = NV_ARCH_03;
+ break;
+ default: /* unknown architecture */
+ break;
+ }
+ return arch;
+}
+
/* ------------------------------------------------------------------------- *
*
* PCI bus
@@ -1844,12 +1838,10 @@
static int __devinit rivafb_probe(struct pci_dev *pd,
const struct pci_device_id *ent)
{
- struct riva_chip_info *rci = &riva_chip_info[ent->driver_data];
struct riva_par *default_par;
struct fb_info *info;
assert(pd != NULL);
- assert(rci != NULL);
info = kmalloc(sizeof(struct fb_info), GFP_KERNEL);
if (!info)
@@ -1990,10 +1993,9 @@
pci_set_drvdata(pd, info);
printk(KERN_INFO PFX
- "PCI nVidia NV%x framebuffer ver %s (%s, %dMB @ 0x%lX)\n",
- default_par->riva.Architecture,
- RIVAFB_VERSION,
+ "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n",
info->fix.id,
+ RIVAFB_VERSION,
info->fix.smem_len / (1024 * 1024),
info->fix.smem_start);
return 0;
@@ -1867,11 +1859,28 @@
goto err_out_kfree1;
memset(info->pixmap.addr, 0, 64 * 1024);
- strcat(rivafb_fix.id, rci->name);
- default_par->riva.Architecture = rci->arch_rev;
+ default_par->riva.Architecture=riva_get_arch(pd);
default_par->Chipset = (pd->vendor << 16) | pd->device;
printk(KERN_INFO PFX "nVidia device/chipset %X\n",default_par->Chipset);
+#ifdef CONFIG_PCI_NAMES
+ printk(KERN_INFO PFX "%s\n", pd->pretty_name);
+#endif
+
+ if(default_par->riva.Architecture >= NV_ARCH_30) {
+ printk(KERN_ERR PFX "NV_ARCH_30 and above not yet supported\n");
+ goto err_out_kfree2;
+ } else if(default_par->riva.Architecture == 0) {
+ printk(KERN_ERR PFX "unknown NV_ARCH\n");
+ goto err_out_kfree2;
+ }
+ if(default_par->riva.Architecture == NV_ARCH_10 ||
+ default_par->riva.Architecture == NV_ARCH_20) {
+ sprintf(rivafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
+ } else {
+ sprintf(rivafb_fix.id, "NV%x", default_par->riva.Architecture);
+ }
+
default_par->FlatPanel = flatpanel;
if (flatpanel == 1)
diff -ub --exclude='*.swp' --exclude='*.agx' --exclude='*.cmd' --exclude='*.o' -Naur ../benh-rsync-2.6-clean/drivers/video/riva/riva_hw.h drivers/video/riva/riva_hw.h
--- ../benh-rsync-2.6-clean/drivers/video/riva/riva_hw.h 2003-11-28 02:35:53.000000000 +0100
+++ drivers/video/riva/riva_hw.h 2004-02-03 21:55:55.000000000 +0100
@@ -95,6 +95,7 @@
#define NV_ARCH_04 0x04
#define NV_ARCH_10 0x10
#define NV_ARCH_20 0x20
+#define NV_ARCH_30 0x30
/***************************************************************************\
* *
Reply to: