aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pm3fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/pm3fb.c')
-rw-r--r--drivers/video/pm3fb.c80
1 files changed, 78 insertions, 2 deletions
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index 88af0721f305..195bcdbc66b5 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -32,6 +32,9 @@
32#include <linux/fb.h> 32#include <linux/fb.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#ifdef CONFIG_MTRR
36#include <asm/mtrr.h>
37#endif
35 38
36#include <video/pm3fb.h> 39#include <video/pm3fb.h>
37 40
@@ -52,6 +55,12 @@
52 * Driver data 55 * Driver data
53 */ 56 */
54static char *mode_option __devinitdata; 57static char *mode_option __devinitdata;
58static int noaccel __devinitdata = 0;
59
60/* mtrr option */
61#ifdef CONFIG_MTRR
62static int nomtrr __devinitdata = 0;
63#endif
55 64
56/* 65/*
57 * This structure defines the hardware state of the graphics card. Normally 66 * This structure defines the hardware state of the graphics card. Normally
@@ -65,6 +74,7 @@ struct pm3_par {
65 u32 video; /* video flags before blanking */ 74 u32 video; /* video flags before blanking */
66 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */ 75 u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */
67 u32 palette[16]; 76 u32 palette[16];
77 int mtrr_handle;
68}; 78};
69 79
70/* 80/*
@@ -1244,6 +1254,13 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
1244 } 1254 }
1245 info->screen_size = pm3fb_fix.smem_len; 1255 info->screen_size = pm3fb_fix.smem_len;
1246 1256
1257#ifdef CONFIG_MTRR
1258 if (!nomtrr) {
1259 par->mtrr_handle = mtrr_add(pm3fb_fix.smem_start,
1260 pm3fb_fix.smem_len,
1261 MTRR_TYPE_WRCOMB, 1);
1262 }
1263#endif
1247 info->fbops = &pm3fb_ops; 1264 info->fbops = &pm3fb_ops;
1248 1265
1249 par->video = PM3_READ_REG(par, PM3VideoControl); 1266 par->video = PM3_READ_REG(par, PM3VideoControl);
@@ -1257,6 +1274,10 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
1257 FBINFO_HWACCEL_IMAGEBLIT | 1274 FBINFO_HWACCEL_IMAGEBLIT |
1258 FBINFO_HWACCEL_FILLRECT; 1275 FBINFO_HWACCEL_FILLRECT;
1259 1276
1277 if (noaccel) {
1278 printk(KERN_DEBUG "disabling acceleration\n");
1279 info->flags |= FBINFO_HWACCEL_DISABLED;
1280 }
1260 info->pixmap.addr = kmalloc(PM3_PIXMAP_SIZE, GFP_KERNEL); 1281 info->pixmap.addr = kmalloc(PM3_PIXMAP_SIZE, GFP_KERNEL);
1261 if (!info->pixmap.addr) { 1282 if (!info->pixmap.addr) {
1262 retval = -ENOMEM; 1283 retval = -ENOMEM;
@@ -1330,6 +1351,11 @@ static void __devexit pm3fb_remove(struct pci_dev *dev)
1330 unregister_framebuffer(info); 1351 unregister_framebuffer(info);
1331 fb_dealloc_cmap(&info->cmap); 1352 fb_dealloc_cmap(&info->cmap);
1332 1353
1354#ifdef CONFIG_MTRR
1355 if (par->mtrr_handle >= 0)
1356 mtrr_del(par->mtrr_handle, info->fix.smem_start,
1357 info->fix.smem_len);
1358#endif /* CONFIG_MTRR */
1333 iounmap(info->screen_base); 1359 iounmap(info->screen_base);
1334 release_mem_region(fix->smem_start, fix->smem_len); 1360 release_mem_region(fix->smem_start, fix->smem_len);
1335 iounmap(par->v_regs); 1361 iounmap(par->v_regs);
@@ -1357,22 +1383,72 @@ static struct pci_driver pm3fb_driver = {
1357 1383
1358MODULE_DEVICE_TABLE(pci, pm3fb_id_table); 1384MODULE_DEVICE_TABLE(pci, pm3fb_id_table);
1359 1385
1386#ifndef MODULE
1387 /*
1388 * Setup
1389 */
1390
1391/*
1392 * Only necessary if your driver takes special options,
1393 * otherwise we fall back on the generic fb_setup().
1394 */
1395static int __init pm3fb_setup(char *options)
1396{
1397 char *this_opt;
1398
1399 /* Parse user speficied options (`video=pm3fb:') */
1400 if (!options || !*options)
1401 return 0;
1402
1403 while ((this_opt = strsep(&options, ",")) != NULL) {
1404 if (!*this_opt)
1405 continue;
1406 else if (!strncmp(this_opt, "noaccel", 7)) {
1407 noaccel = 1;
1408#ifdef CONFIG_MTRR
1409 } else if (!strncmp(this_opt, "nomtrr", 6)) {
1410 nomtrr = 1;
1411#endif
1412 } else {
1413 mode_option = this_opt;
1414 }
1415 }
1416 return 0;
1417}
1418#endif /* MODULE */
1419
1360static int __init pm3fb_init(void) 1420static int __init pm3fb_init(void)
1361{ 1421{
1422 /*
1423 * For kernel boot options (in 'video=pm3fb:<options>' format)
1424 */
1362#ifndef MODULE 1425#ifndef MODULE
1363 if (fb_get_options("pm3fb", NULL)) 1426 char *option = NULL;
1427
1428 if (fb_get_options("pm3fb", &option))
1364 return -ENODEV; 1429 return -ENODEV;
1430 pm3fb_setup(option);
1365#endif 1431#endif
1432
1366 return pci_register_driver(&pm3fb_driver); 1433 return pci_register_driver(&pm3fb_driver);
1367} 1434}
1368 1435
1436#ifdef MODULE
1369static void __exit pm3fb_exit(void) 1437static void __exit pm3fb_exit(void)
1370{ 1438{
1371 pci_unregister_driver(&pm3fb_driver); 1439 pci_unregister_driver(&pm3fb_driver);
1372} 1440}
1373 1441
1374module_init(pm3fb_init);
1375module_exit(pm3fb_exit); 1442module_exit(pm3fb_exit);
1443#endif
1444module_init(pm3fb_init);
1445
1446module_param(noaccel, bool, 0);
1447MODULE_PARM_DESC(noaccel, "Disable acceleration");
1448#ifdef CONFIG_MTRR
1449module_param(nomtrr, bool, 0);
1450MODULE_PARM_DESC(nomtrr, "Disable MTRR support (0 or 1=disabled) (default=0)");
1451#endif
1376 1452
1377MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); 1453MODULE_DESCRIPTION("Permedia3 framebuffer device driver");
1378MODULE_LICENSE("GPL"); 1454MODULE_LICENSE("GPL");