diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2007-10-16 04:28:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:15 -0400 |
commit | 0960bd3db199d73b07e4d266949dcdd6dda10d54 (patch) | |
tree | 7a19b2424d64077d5702bb4495f79f5fe0acc2be | |
parent | 90b0f08536531abbbe7b5d4944792da08cadde01 (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>
-rw-r--r-- | drivers/video/tdfxfb.c | 47 | ||||
-rw-r--r-- | include/video/tdfx.h | 1 |
2 files changed, 44 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 | |||
86 | static inline int mtrr_add(unsigned long base, unsigned long size, | ||
87 | unsigned int type, char increment) | ||
88 | { | ||
89 | return -ENODEV; | ||
90 | } | ||
91 | static 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); | |||
150 | static int nopan; | 167 | static int nopan; |
151 | static int nowrap = 1; /* not implemented (yet) */ | 168 | static int nowrap = 1; /* not implemented (yet) */ |
152 | static int hwcursor = 1; | 169 | static int hwcursor = 1; |
153 | static char *mode_option __devinitdata = NULL; | 170 | static char *mode_option __devinitdata; |
171 | /* mtrr option */ | ||
172 | static 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 | ||
1278 | out_err_iobase: | 1303 | out_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)); |
1281 | out_err_screenbase: | 1309 | out_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"); | |||
1372 | module_param(hwcursor, int, 0644); | 1407 | module_param(hwcursor, int, 0644); |
1373 | MODULE_PARM_DESC(hwcursor, "Enable hardware cursor " | 1408 | MODULE_PARM_DESC(hwcursor, "Enable hardware cursor " |
1374 | "(1=enable, 0=disable, default=1)"); | 1409 | "(1=enable, 0=disable, default=1)"); |
1410 | #ifdef CONFIG_MTRR | ||
1411 | module_param(nomtrr, bool, 0); | ||
1412 | MODULE_PARM_DESC(nomtrr, "Disable MTRR support (default: enabled)"); | ||
1413 | #endif | ||
1375 | 1414 | ||
1376 | module_init(tdfxfb_init); | 1415 | module_init(tdfxfb_init); |
1377 | module_exit(tdfxfb_exit); | 1416 | module_exit(tdfxfb_exit); |
diff --git a/include/video/tdfx.h b/include/video/tdfx.h index 8a2bb91399ce..05b63c2a5abc 100644 --- a/include/video/tdfx.h +++ b/include/video/tdfx.h | |||
@@ -175,6 +175,7 @@ struct tdfx_par { | |||
175 | u32 palette[16]; | 175 | u32 palette[16]; |
176 | void __iomem *regbase_virt; | 176 | void __iomem *regbase_virt; |
177 | unsigned long iobase; | 177 | unsigned long iobase; |
178 | int mtrr_handle; | ||
178 | }; | 179 | }; |
179 | 180 | ||
180 | #endif /* __KERNEL__ */ | 181 | #endif /* __KERNEL__ */ |