Commit 0960bd3d authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

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: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAntonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 90b0f085
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/spinlock.h>
#include <video/tdfx.h> #include <video/tdfx.h>
...@@ -78,6 +77,24 @@ ...@@ -78,6 +77,24 @@
#define DPRINTK(a,b...) #define DPRINTK(a,b...)
#endif #endif
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#else
/* duplicate asm/mtrr.h defines to work on archs without mtrr */
#define MTRR_TYPE_WRCOMB 1
static inline int mtrr_add(unsigned long base, unsigned long size,
unsigned int type, char increment)
{
return -ENODEV;
}
static inline int mtrr_del(int reg, unsigned long base,
unsigned long size)
{
return -ENODEV;
}
#endif
#define BANSHEE_MAX_PIXCLOCK 270000 #define BANSHEE_MAX_PIXCLOCK 270000
#define VOODOO3_MAX_PIXCLOCK 300000 #define VOODOO3_MAX_PIXCLOCK 300000
#define VOODOO5_MAX_PIXCLOCK 350000 #define VOODOO5_MAX_PIXCLOCK 350000
...@@ -150,7 +167,9 @@ MODULE_DEVICE_TABLE(pci, tdfxfb_id_table); ...@@ -150,7 +167,9 @@ MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
static int nopan; static int nopan;
static int nowrap = 1; /* not implemented (yet) */ static int nowrap = 1; /* not implemented (yet) */
static int hwcursor = 1; static int hwcursor = 1;
static char *mode_option __devinitdata = NULL; static char *mode_option __devinitdata;
/* mtrr option */
static int nomtrr __devinitdata;
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
* Hardware-specific funcions * Hardware-specific funcions
...@@ -1227,6 +1246,12 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1227,6 +1246,12 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10); printk("fb: %s memory = %dK\n", tdfx_fix.id, tdfx_fix.smem_len >> 10);
default_par->mtrr_handle = -1;
if (!nomtrr)
default_par->mtrr_handle =
mtrr_add(tdfx_fix.smem_start, tdfx_fix.smem_len,
MTRR_TYPE_WRCOMB, 1);
tdfx_fix.ypanstep = nopan ? 0 : 1; tdfx_fix.ypanstep = nopan ? 0 : 1;
tdfx_fix.ywrapstep = nowrap ? 0 : 1; tdfx_fix.ywrapstep = nowrap ? 0 : 1;
...@@ -1276,6 +1301,9 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, ...@@ -1276,6 +1301,9 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
return 0; return 0;
out_err_iobase: out_err_iobase:
if (default_par->mtrr_handle >= 0)
mtrr_del(default_par->mtrr_handle, info->fix.smem_start,
info->fix.smem_len);
release_mem_region(pci_resource_start(pdev, 2), release_mem_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2)); pci_resource_len(pdev, 2));
out_err_screenbase: out_err_screenbase:
...@@ -1309,8 +1337,12 @@ static void tdfxfb_setup(char *options) ...@@ -1309,8 +1337,12 @@ static void tdfxfb_setup(char *options)
nopan = 1; nopan = 1;
} else if (!strcmp(this_opt, "nowrap")) { } else if (!strcmp(this_opt, "nowrap")) {
nowrap = 1; nowrap = 1;
} else if (!strcmp(this_opt, "hwcursor")) { } else if (!strncmp(this_opt, "hwcursor=", 9)) {
hwcursor = simple_strtoul(opt + 9, NULL, 0); hwcursor = simple_strtoul(this_opt + 9, NULL, 0);
#ifdef CONFIG_MTRR
} else if (!strncmp(this_opt, "nomtrr", 6)) {
nomtrr = 1;
#endif
} else { } else {
mode_option = this_opt; mode_option = this_opt;
} }
...@@ -1333,6 +1365,9 @@ static void __devexit tdfxfb_remove(struct pci_dev *pdev) ...@@ -1333,6 +1365,9 @@ static void __devexit tdfxfb_remove(struct pci_dev *pdev)
struct tdfx_par *par = info->par; struct tdfx_par *par = info->par;
unregister_framebuffer(info); unregister_framebuffer(info);
if (par->mtrr_handle >= 0)
mtrr_del(par->mtrr_handle, info->fix.smem_start,
info->fix.smem_len);
iounmap(par->regbase_virt); iounmap(par->regbase_virt);
iounmap(info->screen_base); iounmap(info->screen_base);
...@@ -1372,6 +1407,10 @@ MODULE_LICENSE("GPL"); ...@@ -1372,6 +1407,10 @@ MODULE_LICENSE("GPL");
module_param(hwcursor, int, 0644); module_param(hwcursor, int, 0644);
MODULE_PARM_DESC(hwcursor, "Enable hardware cursor " MODULE_PARM_DESC(hwcursor, "Enable hardware cursor "
"(1=enable, 0=disable, default=1)"); "(1=enable, 0=disable, default=1)");
#ifdef CONFIG_MTRR
module_param(nomtrr, bool, 0);
MODULE_PARM_DESC(nomtrr, "Disable MTRR support (default: enabled)");
#endif
module_init(tdfxfb_init); module_init(tdfxfb_init);
module_exit(tdfxfb_exit); module_exit(tdfxfb_exit);
...@@ -175,6 +175,7 @@ struct tdfx_par { ...@@ -175,6 +175,7 @@ struct tdfx_par {
u32 palette[16]; u32 palette[16];
void __iomem *regbase_virt; void __iomem *regbase_virt;
unsigned long iobase; unsigned long iobase;
int mtrr_handle;
}; };
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment