Skip to contentSkip to conversation

Rage128 and Radeon patches

PATCH Jon Smirl 6 participants 15 messages Aug 14, 2003 – Aug 15, 2003

Subsystems (2)
lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

Hopefully these is the last versions. They implement:
1) add every know PCI ID
2) access ROM directly instead of relying on copy in low RAM. This allows multiple cards. Required MPP_TB_CONFIG fix in driver.
3) implemented kernel 2.6 module parameters
4) Cleaned up error paths and made sure resources are released on errors. Both build without compiler warnings now. You can ins/rm mod multiple times without problem. Just don't do it from a window in your X server.
5) Driver marks both primary and secondary devices as being in use.

These drivers are bigger than the old ones but that's because I added descriptions for the parameters and a bunch more error messages. Code is probably smaller. Strip the strings and remove unneeded entries from the device table for embedded systems.

I don't own Apple hardware. Anyone want to make sure I didn't break Powerbooks?

It would be nice if someone with Radeon documentation verified my chip IDs and family classifications. It is important that secondary devices are marked correctly in the driver. I did the best I could from Xfree source and PCI databases.

Patches are against the current 2.6 kernel tree. Anyone want to volunteer to get these into the kernel?

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

drivers/video/radeonfb.c +224 -250
diff -Nru a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c
@@ -23,6 +23,9 @@
  *	2002-06-03	MTRR support, Peter Horton, 0.1.5
  *	2002-09-21	rv250, r300, m9 initial support,
  *			added mirror option, 0.1.6
+ * 	2003-08-12	added a bunch more PCI IDs for various Radeons
+ *			converted module params to 2.6 scheme
+ *			Jon Smirl <[email protected]>
  *
  *	Special thanks to ATI DevRel team for their hardware donations.
  *
@@ -34,6 +37,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/string.h>
@@ -91,89 +95,41 @@
 // XXX
 #undef CONFIG_PMAC_PBOOK
 
-
-enum radeon_chips {
-	RADEON_QD,
-	RADEON_QE,
-	RADEON_QF,
-	RADEON_QG,
-	RADEON_QY,
-	RADEON_QZ,
-	RADEON_LW,
-	RADEON_LX,
-	RADEON_LY,
-	RADEON_LZ,
-	RADEON_QL,
-	RADEON_QN,
-	RADEON_QO,
-	RADEON_Ql,
-	RADEON_BB,
-	RADEON_QW,
-	RADEON_QX,
-	RADEON_Id,
-	RADEON_Ie,
-	RADEON_If,
-	RADEON_Ig,
-	RADEON_Ld,
-	RADEON_Le,
-	RADEON_Lf,
-	RADEON_Lg,
-	RADEON_ND,
-	RADEON_NE,
-	RADEON_NF,
-	RADEON_NG,
-	RADEON_QM
-};
-
 enum radeon_arch {
+        RADEON_IGP,
 	RADEON_R100,
 	RADEON_RV100,
 	RADEON_R200,
 	RADEON_RV200,
 	RADEON_RV250,
 	RADEON_R300,
+	RADEON_RS300,
+	RADEON_R350,
 	RADEON_M6,
 	RADEON_M7,
-	RADEON_M9
+	RADEON_M9,
+	RADEON_R200_SEC,
+	RADEON_RV250_SEC,
+	RADEON_R300_SEC,
+	RADEON_R350_SEC,
+	RADEON_M9_SEC,
 };
 
-static struct radeon_chip_info {
-	const char *name;
-	unsigned char arch;
-} radeon_chip_info[] __devinitdata = {
-	{ "QD", RADEON_R100 },
-	{ "QE", RADEON_R100 },
-	{ "QF", RADEON_R100 },
-	{ "QG", RADEON_R100 },
-	{ "VE QY", RADEON_RV100 },
-	{ "VE QZ", RADEON_RV100 },
-	{ "M7 LW", RADEON_M7 },
-	{ "M7 LX", RADEON_M7 },
-	{ "M6 LY", RADEON_M6 },
-	{ "M6 LZ", RADEON_M6 },
-	{ "8500 QL", RADEON_R200 },
-	{ "8500 QN", RADEON_R200 },
-	{ "8500 QO", RADEON_R200 },
-	{ "8500 Ql", RADEON_R200 },
-	{ "8500 BB", RADEON_R200 },
-	{ "7500 QW", RADEON_RV200 },
-	{ "7500 QX", RADEON_RV200 },
-	{ "9000 Id", RADEON_RV250 },
-	{ "9000 Ie", RADEON_RV250 },
-	{ "9000 If", RADEON_RV250 },
-	{ "9000 Ig", RADEON_RV250 },
-	{ "M9 Ld", RADEON_M9 },
-	{ "M9 Le", RADEON_M9 },
-	{ "M9 Lf", RADEON_M9 },
-	{ "M9 Lg", RADEON_M9 },
-	{ "9700 ND", RADEON_R300 },
-	{ "9700 NE", RADEON_R300 },
-	{ "9700 NF", RADEON_R300 },
-	{ "9700 NG", RADEON_R300 },
-	{ "9100 QM", RADEON_R200 }
+static const char *radeon_family[] __devinitdata = {
+	"IGP",
+	"R100",
+	"VE RV100",
+	"8500 R200",
+	"7500 RV200",
+	"9000 RV250",
+	"9700 R300",
+	"9700 RS300",
+	"9800 R350",
+	"Mobility M6",
+	"Mobility M7",
+	"Mobility M9",
 };
-
-
+		    
 enum radeon_montype
 {
 	MT_NONE,
@@ -186,36 +142,67 @@
 
 
 static struct pci_device_id radeonfb_pci_table[] = {
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QD},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QE},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QF},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QG},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QY, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QY},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QZ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QZ},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LW, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_LW},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_LX},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LY, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_LY},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LZ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_LZ},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QL, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QL},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QN, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QN},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QO},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ql, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Ql},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_BB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_BB},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QW, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QW},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QX},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Id, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Id},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ie, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Ie},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_If, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_If},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ig, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Ig},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ld, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Ld},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Le, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Le},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Lf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Lf},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Lg, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_Lg},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_ND, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_ND},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NE},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NF},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NG},
-	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QM, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QM},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_A6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_A7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_AD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_AF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_AG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ad, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_B7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_BB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_D7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_IGP},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Id, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV250},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ie, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV250},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_If, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV250},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ig, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV250},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_In, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV250_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LW, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M7},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M7},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LY, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M6},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_LZ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M6},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ld, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M9},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Le, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M9},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Lf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M9},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Lg, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M9},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ln, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_M9_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_ND, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NH, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R350},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Nd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ne, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Nf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ng, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R300_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Nh, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R350_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QH, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QI, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QJ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QK, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QL, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QM, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QN, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QW, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV200},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QY, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QZ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RV100},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Qh, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Qi, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Qj, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Qk, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_Ql, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_R200_SEC},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_X4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RS300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_X5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RS300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_X6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RS300},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_X7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_RS300},
 	{ 0, }
 };
 MODULE_DEVICE_TABLE(pci, radeonfb_pci_table);
@@ -350,7 +337,7 @@
 	struct radeon_regs state;
 	struct radeon_regs init_state;
 
-	char name[32];
+	char name[DEVICE_NAME_SIZE];
 	char ram_type[12];
 
 	unsigned long mmio_base_phys;
@@ -679,12 +666,14 @@
  */
         
 static char *mode_option __initdata;
-static char noaccel = 1;
-static char mirror = 0;
+static int noaccel = 1;
+static int mirror = 0;
 static int panel_yres __initdata = 0;
-static char force_dfp __initdata = 0;
+static int force_dfp __initdata = 0;
 static struct radeonfb_info *board_list = NULL;
-static char nomtrr __initdata = 0;
+#ifdef CONFIG_MTRR
+static int nomtrr __initdata = 0;
+#endif
 
 /*
  * prototypes
@@ -698,7 +687,10 @@
 static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo);
 static int __devinit radeon_init_disp (struct radeonfb_info *rinfo);
 static int radeon_init_disp_var (struct radeonfb_info *rinfo, struct fb_var_screeninfo *var);
-static char *radeon_find_rom(struct radeonfb_info *rinfo);
+#if defined(__i386__)
+static void __init *radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev *pdev);
+static void __init radeon_unmap_ROM(struct pci_dev *dev, void * rom);
+#endif
 static void radeon_get_pllinfo(struct radeonfb_info *rinfo, char *bios_seg);
 static void radeon_get_moninfo (struct radeonfb_info *rinfo);
 static int radeon_get_dfpinfo (struct radeonfb_info *rinfo);
@@ -731,74 +723,65 @@
 #endif /* CONFIG_PPC_OF */
 
 
-static char *radeon_find_rom(struct radeonfb_info *rinfo)
-{       
 #if defined(__i386__)
-        u32  segstart;
-        char *rom_base;
-        char *rom;
-        int  stage;
-        int  i,j;       
-        char aty_rom_sig[] = "761295520";
-        char *radeon_sig[] = {
-          "RG6",
-          "RADEON"
-        };
-                                                
-        for(segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) {
-                        
-                stage = 1;
-                
-                rom_base = (char *)ioremap(segstart, 0x1000);
-
-                if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa))
-                        stage = 2;
-                
-                    
-                if (stage != 2) {
-                        iounmap(rom_base);
-                        continue;
-                }
-                                              
-                rom = rom_base;
-                     
-                for (i = 0; (i < 128 - strlen(aty_rom_sig)) && (stage != 3); i++) {
-                        if (aty_rom_sig[0] == *rom)
-                                if (strncmp(aty_rom_sig, rom,
-                                                strlen(aty_rom_sig)) == 0)
-                                        stage = 3;
-                        rom++;
-                }
-                if (stage != 3) {
-                        iounmap(rom_base);
-                        continue;
-                }
-                rom = rom_base;
-        
-                for (i = 0; (i < 512) && (stage != 4); i++) {
-                    for(j = 0;j < sizeof(radeon_sig)/sizeof(char *);j++) {
-                        if (radeon_sig[j][0] == *rom)
-                                if (strncmp(radeon_sig[j], rom,
-                                            strlen(radeon_sig[j])) == 0) {
-                                              stage = 4;
-                                              break;
-                                            }
-                    }                           
-                        rom++;
-                }       
-                if (stage != 4) {
-                        iounmap(rom_base);
-                        continue;
-                }       
-                
-                return rom_base;
-        }
-#endif          
-        return NULL;
+static void * __init radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev *dev)
+{
+	// If this is a primary card, there is a shadow copy of the
+	// ROM somewhere in the first meg. We will just ignore the copy
+	// and use the ROM directly.
+    
+    	/* Fix from ATI for problem with Radeon hardware not leaving ROM enabled */
+    	unsigned int temp;
+	temp = INREG(RADEON_MPP_TB_CONFIG);
+	temp &= 0x00ffffffu;
+	temp |= 0x04 << 24;
+	OUTREG(RADEON_MPP_TB_CONFIG, temp);
+	temp = INREG(RADEON_MPP_TB_CONFIG);
+                                                                                                          
+	// no need to search for the ROM, just ask the card where it is.
+	struct resource *r = &dev->resource[PCI_ROM_RESOURCE];
+	void *rom;
+	
+	// assign the ROM an address if it doesn't have one
+	if (r->start == 0)
+		pci_assign_resource(dev, PCI_ROM_RESOURCE);
+	
+	// enable if needed
+	if (!(r->flags & PCI_ROM_ADDRESS_ENABLE)) {
+		pci_write_config_dword(dev, dev->rom_base_reg, r->start | PCI_ROM_ADDRESS_ENABLE);
+		r->flags |= PCI_ROM_ADDRESS_ENABLE;
+	}
+	
+	rom = ioremap(r->start, r->end - r->start + 1);
+	if (!rom) {
+		printk(KERN_ERR "radeonfb: ROM failed to map\n");
+		return NULL;
+	}
+	
+	// Very simple test to make sure it appeared
+	if (readb(rom) != 0x55) {
+		printk(KERN_ERR "radeonfb: Invalid ROM signature %x should be 0x55\n", readb(rom));
+		radeon_unmap_ROM(dev, rom);
+		return NULL;
+	}
+	return rom;
 }
 
-
-
+static void __init radeon_unmap_ROM(struct pci_dev *dev, void * rom)
+{
+	// leave it disabled and unassigned
+	struct resource *r = &dev->resource[PCI_ROM_RESOURCE];
+	
+	iounmap(rom);
+	
+	r->flags &= ~PCI_ROM_ADDRESS_ENABLE;
+	r->end -= r->start;
+	r->start = 0;
+	/* This will disable and set address to unassigned */
+	pci_write_config_dword(dev, dev->rom_base_reg, 0);
+	release_resource(r);
+}
+#endif          
 
 static void radeon_get_pllinfo(struct radeonfb_info *rinfo, char *bios_seg)
 {
@@ -1081,12 +1064,12 @@
 		return 0;
 
 	if (!(fpbiosstart = rinfo->bios_seg + readw(rinfo->bios_seg + 0x48))) {
-		printk("radeonfb: Failed to detect DFP panel info using BIOS\n");
+		printk(KERN_ERR "radeonfb: Failed to detect DFP panel info using BIOS\n");
 		return 0;
 	}
 
 	if (!(tmp = rinfo->bios_seg + readw(fpbiosstart + 0x40))) {
-		printk("radeonfb: Failed to detect DFP panel info using BIOS\n");
+		printk(KERN_ERR "radeonfb: Failed to detect DFP panel info using BIOS\n");
 		return 0;
 	}
 
@@ -1172,7 +1155,7 @@
 				rinfo->panel_xres = 1600;
 				break;
 			default:
-				printk("radeonfb: Failed to detect DFP panel size\n");
+				printk(KERN_ERR "radeonfb: Failed to detect DFP panel size\n");
 				return 0;
 		}
 
@@ -2794,10 +2777,21 @@
 				  const struct pci_device_id *ent)
 {
 	struct radeonfb_info *rinfo;
-	struct radeon_chip_info *rci = &radeon_chip_info[ent->driver_data];
 	u32 tmp;
 
 	RTRACE("radeonfb_pci_register BEGIN\n");
+	
+	/* The driver acknowledges owning secondary devices but they are handled by primary */
+	switch (ent->driver_data) {
+	case RADEON_R200_SEC:
+	case RADEON_RV250_SEC:
+	case RADEON_R300_SEC:
+	case RADEON_R350_SEC:
+	case RADEON_M9_SEC:
+		return 0;
+	default:
+		break;
+	}
 
 	/* Enable device in PCI config */
 	if (pci_enable_device(pdev) != 0) {
@@ -2807,15 +2801,23 @@
 
 	rinfo = kmalloc (sizeof (struct radeonfb_info), GFP_KERNEL);
 	if (!rinfo) {
-		printk ("radeonfb: could not allocate memory\n");
+		printk (KERN_ERR "radeonfb: could not allocate memory\n");
 		return -ENODEV;
 	}
 
 	memset (rinfo, 0, sizeof (struct radeonfb_info));
-	//info = &rinfo->info;
+
 	rinfo->pdev = pdev;
-	strcpy(rinfo->name, rci->name);
-	rinfo->arch = rci->arch;
+	
+	strcpy(rinfo->name, "ATI Radeon XX ");
+	rinfo->name[11] = ent->device >> 8;
+	rinfo->name[12] = ent->device & 0xFF;
+		
+	/* range check to make sure */
+	if (ent->driver_data < (sizeof(radeon_family)/sizeof(char *)))
+	    strncat(rinfo->name, radeon_family[ent->driver_data], sizeof(rinfo->name));
+	
+	rinfo->arch = ent->driver_data;
 
 	/* Set base addrs */
 	rinfo->fb_base_phys = pci_resource_start (pdev, 0);
@@ -2824,30 +2826,21 @@
 	/* request the mem regions */
 	if (!request_mem_region (rinfo->fb_base_phys,
 				 pci_resource_len(pdev, 0), "radeonfb")) {
-		printk ("radeonfb: cannot reserve FB region\n");
-		kfree (rinfo);
-		return -ENODEV;
+		printk (KERN_ERR "radeonfb: cannot reserve FB region\n");
+		goto free_rinfo;
 	}
 
 	if (!request_mem_region (rinfo->mmio_base_phys,
 				 pci_resource_len(pdev, 2), "radeonfb")) {
-		printk ("radeonfb: cannot reserve MMIO region\n");
-		release_mem_region (rinfo->fb_base_phys,
-				    pci_resource_len(pdev, 0));
-		kfree (rinfo);
-		return -ENODEV;
+		printk (KERN_ERR "radeonfb: cannot reserve MMIO region\n");
+		goto release_fb;
 	}
 
 	/* map the regions */
 	rinfo->mmio_base = (unsigned long) ioremap (rinfo->mmio_base_phys, RADEON_REGSIZE);
 	if (!rinfo->mmio_base) {
-		printk ("radeonfb: cannot map MMIO\n");
-		release_mem_region (rinfo->mmio_base_phys,
-				    pci_resource_len(pdev, 2));
-		release_mem_region (rinfo->fb_base_phys,
-				    pci_resource_len(pdev, 0));
-		kfree (rinfo);
-		return -ENODEV;
+		printk (KERN_ERR "radeonfb: cannot map MMIO\n");
+		goto release_mmio;
 	}
 
 	rinfo->chipset = pdev->device;
@@ -2924,7 +2917,7 @@
 			break;
 	}
 
-	rinfo->bios_seg = radeon_find_rom(rinfo);
+	rinfo->bios_seg = radeon_map_ROM(rinfo, pdev);
 	radeon_get_pllinfo(rinfo, rinfo->bios_seg);
 
 	/*
@@ -2966,26 +2959,14 @@
 	if ((rinfo->dviDisp_type == MT_DFP) || (rinfo->dviDisp_type == MT_LCD) ||
 	    (rinfo->crtDisp_type == MT_DFP)) {
 		if (!radeon_get_dfpinfo(rinfo)) {
-			iounmap ((void*)rinfo->mmio_base);
-			release_mem_region (rinfo->mmio_base_phys,
-					    pci_resource_len(pdev, 2));
-			release_mem_region (rinfo->fb_base_phys,
-					    pci_resource_len(pdev, 0));
-			kfree (rinfo);
-			return -ENODEV;
+			goto unmap_rom;
 		}
 	}
 
 	rinfo->fb_base = (unsigned long) ioremap (rinfo->fb_base_phys, rinfo->video_ram);
 	if (!rinfo->fb_base) {
-		printk ("radeonfb: cannot map FB\n");
-		iounmap ((void*)rinfo->mmio_base);
-		release_mem_region (rinfo->mmio_base_phys,
-				    pci_resource_len(pdev, 2));
-		release_mem_region (rinfo->fb_base_phys,
-				    pci_resource_len(pdev, 0));
-		kfree (rinfo);
-		return -ENODEV;
+		printk (KERN_ERR "radeonfb: cannot map FB\n");
+		goto unmap_rom;
 	}
 
 	/* I SHOULD FIX THAT CRAP ! I should probably mimmic XFree DRI
@@ -3035,15 +3016,8 @@
 	board_list = rinfo;
 
 	if (register_framebuffer ((struct fb_info *) rinfo) < 0) {
-		printk ("radeonfb: could not register framebuffer\n");
-		iounmap ((void*)rinfo->fb_base);
-		iounmap ((void*)rinfo->mmio_base);
-		release_mem_region (rinfo->mmio_base_phys,
-				    pci_resource_len(pdev, 2));
-		release_mem_region (rinfo->fb_base_phys,
-				    pci_resource_len(pdev, 0));
-		kfree (rinfo);
-		return -ENODEV;
+		printk (KERN_ERR "radeonfb: could not register framebuffer\n");
+		goto unmap_fb;
 	}
 
 #ifdef CONFIG_MTRR
@@ -3065,7 +3039,7 @@
 	}
 #endif
 
-	printk ("radeonfb: ATI Radeon %s %s %d MB\n", rinfo->name, rinfo->ram_type,
+	printk ("radeonfb: %s %s %d MB\n", rinfo->name, rinfo->ram_type,
 		(rinfo->video_ram/(1024*1024)));
 
 	if (rinfo->hasCRTC2) {
@@ -3078,9 +3052,24 @@
 			GET_MON_NAME(rinfo->crtDisp_type));
 	}
 
+	radeon_unmap_ROM(pdev, rinfo->bios_seg);
 	RTRACE("radeonfb_pci_register END\n");
 
 	return 0;
+unmap_fb:
+	iounmap ((void*)rinfo->fb_base);
+unmap_rom:	
+	radeon_unmap_ROM(pdev, rinfo->bios_seg);
+	iounmap ((void*)rinfo->mmio_base);
+release_mmio:
+	release_mem_region (rinfo->mmio_base_phys,
+			    pci_resource_len(pdev, 2));
+release_fb:	
+	release_mem_region (rinfo->fb_base_phys,
+			    pci_resource_len(pdev, 0));
+free_rinfo:	
+	kfree (rinfo);
+	return -ENODEV;
 }
 
 
@@ -3137,40 +3126,25 @@
 	pci_unregister_driver (&radeonfb_driver);
 }
 
-
-int __init radeonfb_setup (char *options)
-{
-        char *this_opt;
-
-        if (!options || !*options)
-                return 0;
- 
-	while ((this_opt = strsep (&options, ",")) != NULL) {
-		if (!*this_opt)
-			continue;
-                if (!strncmp(this_opt, "noaccel", 7)) {
-			noaccel = 1;
-                } else if (!strncmp(this_opt, "mirror", 6)) {
-			mirror = 1;
-		} else if (!strncmp(this_opt, "dfp", 3)) {
-			force_dfp = 1;
-		} else if (!strncmp(this_opt, "panel_yres:", 11)) {
-			panel_yres = simple_strtoul((this_opt+11), NULL, 0);
-		} else if (!strncmp(this_opt, "nomtrr", 6)) {
-			nomtrr = 1;
-                } else
-			mode_option = this_opt;
-        }
-
-	return 0;
-}
-
 #ifdef MODULE
 module_init(radeonfb_init);
 module_exit(radeonfb_exit);
 #endif
 
-
 MODULE_AUTHOR("Ani Joshi");
 MODULE_DESCRIPTION("framebuffer driver for ATI Radeon chipset");
 MODULE_LICENSE("GPL");
+module_param(noaccel, bool, 0);
+MODULE_PARM_DESC(noaccel, "bool: disable acceleration");
+module_param(mirror, bool, 0);
+MODULE_PARM_DESC(mirror, "bool: mirror the display to both monitors");
+module_param(force_dfp, bool, 0);
+MODULE_PARM_DESC(force_dfp, "bool: force display to dfp");
+#ifdef CONFIG_MTRR
+module_param(nomtrr, bool, 0);
+MODULE_PARM_DESC(nomtrr, "bool: disable use of MTRR registers");
+#endif
+module_param(panel_yres, int, 0);
+MODULE_PARM_DESC(force_dfp, "int: set panel yres");
+module_param(mode_option, charp, 0);
+MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");
include/linux/pci_ids.h +59 -37

114 lines not on this page · raw message

include/video/radeon.h +3 -0
diff -Nru a/include/video/radeon.h b/include/video/radeon.h
@@ -872,5 +872,8 @@
 
 #define GUI_ACTIVE			0x80000000
 
+/* used by ATI bug fix for hardware ROM */
+#define RADEON_MPP_TB_CONFIG            0x01c0
+
 #endif	/* _RADEON_H */
 
drivers/video/aty/aty128fb.c +179 -145

475 lines not on this page · raw message

include/linux/pci_ids.h +28 -20

65 lines not on this page · raw message

include/video/aty128.h +3 -0
diff -Nru a/include/video/aty128.h b/include/video/aty128.h
@@ -416,4 +416,7 @@
 
 #define PMI_PMSCR_REG				0x60
 
+/* used by ATI bug fix for hardware ROM */
+#define RAGE128_MPP_TB_CONFIG            	0x01c0
+
 #endif				/* REG_RAGE128_H */
#1 lore raw
Quoted 1 line · Jon Smirl

Hopefully these is the last versions. They implement:

Please CC me any further radeonfb patches, I have my own stuff pending that I need to sync (and I sort of took over maintainership)

Quoted 4 lines

1) add every know PCI ID
2) access ROM directly instead of relying on copy in low RAM. This allows multiple cards. Required MPP_TB_CONFIG fix in driver.

This is a problem. We also parse it to find the DFP EDID and/or flat panel informations, do that work with the real ROM ? I don't know much about x86 BIOSes, but at least for the DFP EDID, I suppose that one is read in RAM by the BIOS, not in the ROM...

Quoted 9 lines

3) implemented kernel 2.6 module parameters
4) Cleaned up error paths and made sure resources are released on errors. Both build without compiler warnings now. You can ins/rm mod multiple times without problem. Just don't do it from a window in your X server.
5) Driver marks both primary and secondary devices as being in use.

Quoted 8 lines

These drivers are bigger than the old ones but that's because I added descriptions for the parameters and a bunch more error messages. Code is probably smaller. Strip the strings and remove unneeded entries from the device table for embedded systems.

I don't own Apple hardware. Anyone want to make sure I didn't break Powerbooks?

You may want to look at the version I have in my tree
on ppc.bkbits.net/linuxppc-2.5-benh. I don't have much time to sync with your before a couple of weeks for now... This version rely on my Power Management stuffs I posted earlier that James didn't seem to merge yet though.

Quoted 5 lines

It would be nice if someone with Radeon documentation verified my chip IDs and family classifications. It is important that secondary devices are marked correctly in the driver. I did the best I could from Xfree source and PCI databases.

The ChipIDs aren't in the documentation. I suppose the best source here is the XFree driver.

Quoted 12 lines

Patches are against the current 2.6 kernel tree. Anyone want to volunteer to get these into the kernel?

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Signature · 8 lines
Benjamin Herrenschmidt <[email protected]>


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
#6 lore raw
In reply to Jon Smirl
Quoted 5 lines · --- Jon Smirl

Hopefully these is the last versions. They implement:
1) add every know PCI ID
2) access ROM directly instead of relying on copy in low RAM. This allows multiple cards. Required MPP_TB_CONFIG fix in driver.

Is this patch necessary for xfree86? It may address some of the issues in the email threads I sent out yesterday (ie, problems with multiple radeon cards and xfree86). if so would you consider making one?

Alex

Quoted 9 lines

3) implemented kernel 2.6 module parameters
4) Cleaned up error paths and made sure resources are released on errors. Both build without compiler warnings now. You can ins/rm mod multiple times without problem. Just don't do it from a window in your X server.
5) Driver marks both primary and secondary devices as being in use.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

author
#2 lore raw
In reply to Benjamin Herrenschmidt

--- Benjamin Herrenschmidt <[email protected]>

Quoted 6 lines · wrote:

This is a problem. We also parse it to find the DFP EDID and/or flat panel informations, do that work with the real ROM ? I don't know much about x86 BIOSes, but at least for the DFP EDID, I suppose that one is read in RAM by the BIOS, not in the ROM...

On x86 machines low RAM contains a copy of the ROM, now you are getting a pointer to the real ROM. The contents are identical. The only difference is that you need to use the readb()/readw()/etc macros to read it. On the x86 readb() does nothing, but on other platforms it will trigger a PCI read cycle. This plus side to this is that you can use multiple video cards.

The ROM stuff is only enabled on the X86 platform. It was IFDEF'd that way before I made my changes. I did not change the way it was previously IFDEF'd for other platforms. You may want to try enabling the ROM on the Apple platforms. It will probably work, if it does change the IFDEFs. The old technique of relying on the copy in low memory does not work on Apples since their BIOS doesn't make the copy, that's why it was IFDEF'd off.

Quoted 2 lines

You may want to look at the version I have in my tree on ppc.bkbits.net/linuxppc-2.5-benh. I don't

have

Quoted 4 lines

much time to sync with your before a couple of weeks

for now... This version rely on my Power Management stuffs I posted earlier that James didn't seem to

merge

Quoted 1 line

yet though.

I looked through the diff for this. The only potential conflict is where I cleaned up some error paths. Please keep my changes as the old code was not freeing resources where it should have. You may want to experiment with enabling the ROM on the Mac.

My code does not change the behavior of the driver other than by adding PCI IDs and the way the ROM is accessed on the X86. It would be nice if you could check out my code and at least make sure it compiles and loads on a Powerbook.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

author
#7 lore raw
In reply to Alex Deucher
Quoted 11 lines · --- Alex Deucher
Quoted 3 lines

2) access ROM directly instead of relying on copy
in low RAM. This allows multiple cards. Required
MPP_TB_CONFIG fix in driver.

Is this patch necessary for xfree86? It may address some of the issues
in the email threads I sent out yesterday (ie, problems with multiple
radeon cards and xfree86). if so would you consider making one?

Xfree code does not have the patch, but is Xfree experiencing the bug? Xfree accesses the hardware very differently than the framebuffer drivers.

I suspect that you would see this problem if you were using something else for your primary video and a Radeon for secondary. The first time you ran Xfree it would work. But when you exited and restarted Xfree it would hang when starting the secondary display.

Where does XFree reset the secondary card? The code below needs to run right after the reset in the radeon driver. I added it to my Rage128 driver too but I have not observed the problem with them.

Framebuffer code is different and triggers the bug the first time the secondary display is accessed.

/* Fix from ATI for problem with Radeon hardware not leaving ROM enabled */
unsigned int temp;
temp = INREG(RADEON_MPP_TB_CONFIG);
temp &= 0x00ffffffu;
temp |= 0x04 << 24; OUTREG(RADEON_MPP_TB_CONFIG, temp);
temp = INREG(RADEON_MPP_TB_CONFIG);

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#8 lore raw

I haven't tried multiple radeon cards, but I seem to recall several people having this problem right around when 4.3.0 was released. I don't think a "proper" fix ever went in and I think the issue was to be revisited later. I don't know if it's needed anymore or not.

Alex

Quoted 41 lines · --- Jon Smirl
Quoted 11 lines · --- Alex Deucher
Quoted 3 lines

2) access ROM directly instead of relying on copy
in low RAM. This allows multiple cards. Required
MPP_TB_CONFIG fix in driver.

Is this patch necessary for xfree86? It may address some of the issues
in the email threads I sent out yesterday (ie, problems with multiple
radeon cards and xfree86). if so would you consider making one?

Xfree code does not have the patch, but is Xfree experiencing the bug? Xfree accesses the hardware very differently than the framebuffer drivers.

I suspect that you would see this problem if you were using something else for your primary video and a Radeon for secondary. The first time you ran Xfree it would work. But when you exited and restarted Xfree it would hang when starting the secondary display.

Where does XFree reset the secondary card? The code below needs to run right after the reset in the radeon driver. I added it to my Rage128 driver too but I have not observed the problem with them.

Framebuffer code is different and triggers the bug the first time the secondary display is accessed.

/* Fix from ATI for problem with Radeon hardware not leaving ROM enabled */
unsigned int temp;
temp = INREG(RADEON_MPP_TB_CONFIG);
temp &= 0x00ffffffu;
temp |= 0x04 << 24; OUTREG(RADEON_MPP_TB_CONFIG, temp);
temp = INREG(RADEON_MPP_TB_CONFIG);

Quoted 4 lines

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#10 lore raw

dri fb drivers [was: Re: Rage128 and Radeon patches]

In reply to Jon Smirl
Quoted 5 lines · Jon Smirl

Hopefully these is the last versions. They implement:
1) add every know PCI ID
2) access ROM directly instead of relying on copy in low RAM. This allows multiple cards. Required MPP_TB_CONFIG fix in driver.

Quoted 8 lines

3) implemented kernel 2.6 module parameters
4) Cleaned up error paths and made sure resources are released on errors. Both build without compiler warnings now. You can ins/rm mod multiple times without problem. Just don't do it from a window in your X server.
5) Driver marks both primary and secondary devices as being in use.

nice work!

i know you are working with the dri fb drivers, is any progress and what is the current state?

-solca

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#9 lore raw
In reply to Alex Deucher
Quoted 5 lines · Alex Deucher

I haven't tried multiple radeon cards, but I seem to recall several people having this problem right around when 4.3.0 was released. I don't think a "proper" fix ever went in and I think the issue was to be revisited later. I don't know if it's needed anymore or not.

It is still needed, Radeon as a secondary display only works on the first initialisation (it can not find ROM on subsequent attempts) in all XFree86 versions I have tried up to and including current CVS. At least on my hardware... :-/

Quoted 43 lines

Alex

Quoted 40 lines · --- Jon Smirl
Quoted 11 lines · --- Alex Deucher
Quoted 3 lines

2) access ROM directly instead of relying on copy
in low RAM. This allows multiple cards. Required
MPP_TB_CONFIG fix in driver.

Is this patch necessary for xfree86? It may address some of the issues
in the email threads I sent out yesterday (ie, problems with multiple
radeon cards and xfree86). if so would you consider making one?

Xfree code does not have the patch, but is Xfree experiencing the bug? Xfree accesses the hardware very differently than the framebuffer drivers.

I suspect that you would see this problem if you were using something else for your primary video and a Radeon for secondary. The first time you ran Xfree it would work. But when you exited and restarted Xfree it would hang when starting the secondary display.

Where does XFree reset the secondary card? The code below needs to run right after the reset in the radeon driver. I added it to my Rage128 driver too but I have not observed the problem with them.

Framebuffer code is different and triggers the bug the first time the secondary display is accessed.

/* Fix from ATI for problem with Radeon hardware not leaving ROM enabled */
unsigned int temp;
temp = INREG(RADEON_MPP_TB_CONFIG);
temp &= 0x00ffffffu;
temp |= 0x04 << 24; OUTREG(RADEON_MPP_TB_CONFIG, temp);
temp = INREG(RADEON_MPP_TB_CONFIG);

author
#11 lore raw

Re: dri fb drivers [was: Re: [Linux-fbdev-devel] Rage128 and Radeon patches]

In reply to Otto Solares
Quoted 4 lines · --- Otto Solares

nice work!

i know you are working with the dri fb drivers, is any progress and what is the current state?

I am working on embedded Mesa, which is another name for standalone OpenGL. Embedded Mesa is based on the 3D DRI code but it handles 2D very differently.

Xfree/DRI scans the PCI bus and initializes hardware in it's user space process. Embedded Mesa instead loads the framebuffer drivers and uses them to initialize the hardware. This makes Embedded Mesa much simpler since it relies on the framebuffer drivers for a lot of things such as mode switching and PCI bus scanning.

You can get a snapshot of my work with this:
bk clone bk://mesa3d.bkbits.net/jonsmirl local_name

Standalone OpenGL works for most all Radeon chips if you also use the updated framebuffers. Rage128 and MGA support and being worked on but they are not ready yet. This is development level code and it is not ready for testing.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#12 lore raw

Re: dri fb drivers [was: Re: Rage128 and Radeon patches]

Quoted 17 lines
Quoted 4 lines

nice work!

i know you are working with the dri fb drivers, is any progress and what is the current state?

I am working on embedded Mesa, which is another name for standalone OpenGL. Embedded Mesa is based on the 3D DRI code but it handles 2D very differently.

Xfree/DRI scans the PCI bus and initializes hardware in it's user space process. Embedded Mesa instead loads the framebuffer drivers and uses them to initialize the hardware. This makes Embedded Mesa much simpler since it relies on the framebuffer drivers for a lot of things such as mode switching and PCI bus scanning.

Quoted 8 lines

You can get a snapshot of my work with this:
bk clone bk://mesa3d.bkbits.net/jonsmirl local_name

Standalone OpenGL works for most all Radeon chips if you also use the updated framebuffers. Rage128 and MGA support and being worked on but they are not ready yet. This is development level code and it is not ready for testing.

Oh wow. That is way to cool!!!! I suggest you merge your work with the khronos group. It would be really nice to see a embedded OpenML implementation. I'm looking into this since I plan to implement Java3D /JavaX media layer for GNU Classpath/Kaffe in the near future.

http://www.khronos.org/

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#13 lore raw

Re: dri fb drivers [was: Re: Rage128 and Radeon patches]

In reply to Jon Smirl
Quoted 10 lines · Jon Smirl
Quoted 4 lines · --- Otto Solares

nice work!

i know you are working with the dri fb drivers, is any progress and what is the current state?

I am working on embedded Mesa, which is another name for standalone OpenGL. Embedded Mesa is based on the 3D DRI code but it handles 2D very differently.

Quoted 7 lines

Xfree/DRI scans the PCI bus and initializes hardware in it's user space process. Embedded Mesa instead loads the framebuffer drivers and uses them to initialize the hardware. This makes Embedded Mesa much simpler since it relies on the framebuffer drivers for a lot of things such as mode switching and PCI bus scanning.

good! IMO this is the future for linux!
i would like to see this work merged with the dri.sf.net folks and a unified set of drivers for both fb and Xfree. Is this possible, is this your objective? or embedded mesa will always be an standalone project...

-solca

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

author
#14 lore raw

Re: Re: dri fb drivers [was: Re: [Linux-fbdev-devel] Rage128 and Radeon patches]

Quoted 6 lines · --- Otto Solares

good! IMO this is the future for linux!
i would like to see this work merged with the dri.sf.net folks and a unified set of drivers for both fb and Xfree. Is this possible, is this your objective? or embedded mesa will always be an standalone project...

The long term plan is for a single OpenGL shared object that runs standalone, with DirectFB or under XFree/DRI. There is nothing technical stopping this, it just a matter of adjusting bunches of code.

3D drivers from DRI work in the embedded version with minor changes mostly having to do with removing GLX code from the drivers. 2D is a different story. Significant code needs to be adjusted for each driver. I am working on the Rage128 driver currently. Radeon and MGA are done. Nothing else has been started yet.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#3 lore raw
In reply to Jon Smirl
Quoted 9 lines · Jon Smirl

--- Benjamin Herrenschmidt <[email protected]>

Quoted 6 lines · wrote:

This is a problem. We also parse it to find the DFP EDID and/or flat panel informations, do that work with the real ROM ? I don't know much about x86 BIOSes, but at least for the DFP EDID, I suppose that one is read in RAM by the BIOS, not in the ROM...

Quoted 7 lines

On x86 machines low RAM contains a copy of the ROM, now you are getting a pointer to the real ROM. The contents are identical. The only difference is that you need to use the readb()/readw()/etc macros to read it. On the x86 readb() does nothing, but on other platforms it will trigger a PCI read cycle. This plus side to this is that you can use multiple video cards.

Well... Again, this has to be verified in real life, but my understanding is that the BIOS code, once it has probed the DFP flat panel, will put the EDID data in RAM somewhere within the copy of the BIOS, which is where we then find it... The best thing would still be, of course, to implement full DDC probing in radeonfb like XFree does. This has been on my todolist for a while now, but I lack time.

Ben.

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

author
#4 lore raw

--- Benjamin Herrenschmidt <[email protected]>

Quoted 14 lines · wrote:

Well... Again, this has to be verified in real life, but
my understanding is that the BIOS code, once it has probed
the DFP flat panel, will put the EDID data in RAM somewhere
within the copy of the BIOS, which is where we then find
it... The best thing would still be, of course, to implement
full DDC probing in radeonfb like XFree does. This has been
on my todolist for a while now, but I lack time.

Quoted 2 lines

Ben.

Putting the EDID data into the RAM copy will never work the case where there are multiple cards since there is only one copy of the ROM in low RAM.

Personally I'd just like to ignore the boot VROM and do everything in the Radeon driver code. But ATI won't give out detailed info on how to read EDID or reset the card with C code from the driver. So instead we end up with the idiotic x86 emulator and doing INT10's in simulated real mode.

Maybe someone with more leverage can coax this info out of them.....

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#5 lore raw
Quoted 4 lines

Putting the EDID data into the RAM copy will never work the case where there are multiple cards since there is only one copy of the ROM in low RAM.

Yup, but at least it works for single cards, and that helps a lot of users until radeonfb can do better

Quoted 9 lines

Personally I'd just like to ignore the boot VROM and do everything in the Radeon driver code. But ATI won't give out detailed info on how to read EDID or reset the card with C code from the driver. So instead we end up with the idiotic x86 emulator and doing INT10's in simulated real mode.

Maybe someone with more leverage can coax this info out of them.....

Getting the full POST code is probably a lost cause. However, if you look at the current XFree CVS driver, you'll see rather complete code to get the EDID via DDC/i2c on all connectors.

Ben.

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01