aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tdfxfb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-16 04:28:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:15 -0400
commit0960bd3db199d73b07e4d266949dcdd6dda10d54 (patch)
tree7a19b2424d64077d5702bb4495f79f5fe0acc2be /drivers/video/tdfxfb.c
parent90b0f08536531abbbe7b5d4944792da08cadde01 (diff)
tdfxfb: mtrr support
This patch adds mtrr support to the tdfxfb driver. It also kills one redundant include and initialization value. [akpm@linux-foundation.org: cleanups] Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/tdfxfb.c')
-rw-r--r--drivers/video/tdfxfb.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
index c5ba6477dfe2..c7ec5f382608 100644
--- a/drivers/video/tdfxfb.c
+++ b/drivers/video/tdfxfb.c
@@ -67,7 +67,6 @@
67#include <linux/init.h> 67#include <linux/init.h>
68#include <linux/pci.h> 68#include <linux/pci.h>
69#include <asm/io.h> 69#include <asm/io.h>
70#include <linux/spinlock.h>
71 70
72#include <video/tdfx.h> 71#include <video/tdfx.h>
73 72
@@ -78,6 +77,24 @@
78#define DPRINTK(a,b...) 77#define DPRINTK(a,b...)
79#endif 78#endif
80 79
80#ifdef CONFIG_MTRR
81#include <asm/mtrr.h>
82#else
83/* duplicate asm/mtrr.h defines to work on archs without mtrr */
84#define MTRR_TYPE_WRCOMB 1
85
86static inline int mtrr_add(unsigned long base, unsigned long size,
87 unsigned int type, char increment)
88{
89 return -ENODEV;
90}
91static inline int mtrr_del(int reg, unsigned long base,
92 unsigned long size)
93{
94 return -ENODEV;
95}
96#endif
97
81#define BANSHEE_MAX_PIXCLOCK 270000 98#define BANSHEE_MAX_PIXCLOCK 270000
82#define VOODOO3_MAX_PIXCLOCK 300000 99#define VOODOO3_MAX_PIXCLOCK 300000
83#define VOODOO5_MAX_PIXCLOCK 350000 100#define VOODOO5_MAX_PIXCLOCK 350000
@@ -150,7 +167,9 @@ MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
150static int nopan; 167static int nopan;
151static int nowrap = 1; /* not implemented (yet) */ 168static int nowrap = 1; /* not implemented (yet) */
152static int hwcursor = 1; 169static int hwcursor = 1;
153static char *mode_option __devinitdata = NULL; 170static char *mode_option __devinitdata;
171/* mtrr option */
172static int nomtrr __devinitdata;
154 173
155/* ------------------------------------------------------------------------- 174/* -------------------------------------------------------------------------
156 * Hardware-specific funcions 175 * Hardware-specific funcions
@@ -1227,6 +1246,12 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
1227 1246
1228 printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10); 1247 printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10);
1229 1248
1249 default_par->mtrr_handle = -1;
1250 if (!nomtrr)
1251 default_par->mtrr_handle =
1252 mtrr_add(tdfx_fix.smem_start, tdfx_fix.smem_len,
1253 MTRR_TYPE_WRCOMB, 1);
1254
1230 tdfx_fix.ypanstep = nopan ? 0 : 1; 1255 tdfx_fix.ypanstep = nopan ? 0 : 1;
1231 tdfx_fix.ywrapstep = nowrap ? 0 : 1; 1256 tdfx_fix.ywrapstep = nowrap ? 0 : 1;
1232 1257
@@ -1276,6 +1301,9 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
1276 return 0; 1301 return 0;
1277 1302
1278out_err_iobase: 1303out_err_iobase:
1304 if (default_par->mtrr_handle >= 0)
1305 mtrr_del(default_par->mtrr_handle, info->fix.smem_start,
1306 info->fix.smem_len);
1279 release_mem_region(pci_resource_start(pdev, 2), 1307 release_mem_region(pci_resource_start(pdev, 2),
1280 pci_resource_len(pdev, 2)); 1308 pci_resource_len(pdev, 2));
1281out_err_screenbase: 1309out_err_screenbase:
@@ -1309,8 +1337,12 @@ static void tdfxfb_setup(char *options)
1309 nopan = 1; 1337 nopan = 1;
1310 } else if (!strcmp(this_opt, "nowrap")) { 1338 } else if (!strcmp(this_opt, "nowrap")) {
1311 nowrap = 1; 1339 nowrap = 1;
1312 } else if (!strcmp(this_opt, "hwcursor")) { 1340 } else if (!strncmp(this_opt, "hwcursor=", 9)) {
1313 hwcursor = simple_strtoul(opt + 9, NULL, 0); 1341 hwcursor = simple_strtoul(this_opt + 9, NULL, 0);
1342#ifdef CONFIG_MTRR
1343 } else if (!strncmp(this_opt, "nomtrr", 6)) {
1344 nomtrr = 1;
1345#endif
1314 } else { 1346 } else {
1315 mode_option = this_opt; 1347 mode_option = this_opt;
1316 } 1348 }
@@ -1333,6 +1365,9 @@ static void __devexit tdfxfb_remove(struct pci_dev *pdev)
1333 struct tdfx_par *par = info->par; 1365 struct tdfx_par *par = info->par;
1334 1366
1335 unregister_framebuffer(info); 1367 unregister_framebuffer(info);
1368 if (par->mtrr_handle >= 0)
1369 mtrr_del(par->mtrr_handle, info->fix.smem_start,
1370 info->fix.smem_len);
1336 iounmap(par->regbase_virt); 1371 iounmap(par->regbase_virt);
1337 iounmap(info->screen_base); 1372 iounmap(info->screen_base);
1338 1373
@@ -1372,6 +1407,10 @@ MODULE_LICENSE("GPL");
1372module_param(hwcursor, int, 0644); 1407module_param(hwcursor, int, 0644);
1373MODULE_PARM_DESC(hwcursor, "Enable hardware cursor " 1408MODULE_PARM_DESC(hwcursor, "Enable hardware cursor "
1374 "(1=enable, 0=disable, default=1)"); 1409 "(1=enable, 0=disable, default=1)");
1410#ifdef CONFIG_MTRR
1411module_param(nomtrr, bool, 0);
1412MODULE_PARM_DESC(nomtrr, "Disable MTRR support (default: enabled)");
1413#endif
1375 1414
1376module_init(tdfxfb_init); 1415module_init(tdfxfb_init);
1377module_exit(tdfxfb_exit); 1416module_exit(tdfxfb_exit);