Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / video / matrox / matroxfb_base.c
index 98e00d8..23c1827 100644 (file)
@@ -99,7 +99,6 @@
  *
  */
 
-/* make checkconfig does not check included files... */
 #include <linux/config.h>
 #include <linux/version.h>
 
 #include <asm/uaccess.h>
 
 #ifdef CONFIG_PPC_PMAC
+#include <asm/machdep.h>
 unsigned char nvram_read_byte(int);
 static int default_vmode = VMODE_NVRAM;
 static int default_cmode = CMODE_NVRAM;
@@ -264,7 +264,6 @@ static void matroxfb_disable_irq(WPMINFO2) {
 }
 
 int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) {
-       wait_queue_t __wait;
        struct matrox_vsync *vs;
        unsigned int cnt;
        int ret;
@@ -286,7 +285,6 @@ int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) {
        if (ret) {
                return ret;
        }
-        init_waitqueue_entry(&__wait, current);
 
        cnt = vs->cnt;
        ret = wait_event_interruptible_timeout(vs->wait, cnt != vs->cnt, HZ/10);
@@ -500,10 +498,6 @@ static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) {
        } else {
                xres_new = matroxfb_test_and_set_rounding(PMINFO xres, bpp);
        }
-       if (!xres_new) return 0;
-       if (xres != xres_new) {
-               printk(KERN_INFO "matroxfb: cannot set xres to %d, rounded up to %d\n", xres, xres_new);
-       }
        return xres_new;
 }
 
@@ -871,9 +865,8 @@ static struct matrox_altout panellink_output = {
        .name    = "Panellink output",
 };
 
-static int matroxfb_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg,
-                         struct fb_info *info)
+static int matroxfb_ioctl(struct fb_info *info,
+                         unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        MINFO_FROM_INFO(info);
@@ -1285,7 +1278,7 @@ static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSi
        vaddr_t vm;
        unsigned int offs;
        unsigned int offs2;
-       unsigned char store;
+       unsigned char orig;
        unsigned char bytes[32];
        unsigned char* tmp;
 
@@ -1298,18 +1291,15 @@ static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSi
        if (maxSize > 0x2000000) maxSize = 0x2000000;
 
        mga_outb(M_EXTVGA_INDEX, 0x03);
-       mga_outb(M_EXTVGA_DATA, mga_inb(M_EXTVGA_DATA) | 0x80);
+       orig = mga_inb(M_EXTVGA_DATA);
+       mga_outb(M_EXTVGA_DATA, orig | 0x80);
 
-       store = mga_readb(vm, 0x1234);
        tmp = bytes;
        for (offs = 0x100000; offs < maxSize; offs += 0x200000)
                *tmp++ = mga_readb(vm, offs);
        for (offs = 0x100000; offs < maxSize; offs += 0x200000)
                mga_writeb(vm, offs, 0x02);
-       if (ACCESS_FBINFO(features.accel.has_cacheflush))
-               mga_outb(M_CACHEFLUSH, 0x00);
-       else
-               mga_writeb(vm, 0x1234, 0x99);
+       mga_outb(M_CACHEFLUSH, 0x00);
        for (offs = 0x100000; offs < maxSize; offs += 0x200000) {
                if (mga_readb(vm, offs) != 0x02)
                        break;
@@ -1320,10 +1310,9 @@ static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSi
        tmp = bytes;
        for (offs2 = 0x100000; offs2 < maxSize; offs2 += 0x200000)
                mga_writeb(vm, offs2, *tmp++);
-       mga_writeb(vm, 0x1234, store);
 
        mga_outb(M_EXTVGA_INDEX, 0x03);
-       mga_outb(M_EXTVGA_DATA, mga_inb(M_EXTVGA_DATA) & ~0x80);
+       mga_outb(M_EXTVGA_DATA, orig);
 
        *realSize = offs - 0x100000;
 #ifdef CONFIG_FB_MATROX_MILLENIUM
@@ -1429,6 +1418,20 @@ static struct board {
                MGA_1164,
                &vbMystique,
                "Mystique 220 (PCI)"},
+       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_MYS_AGP,   0x02,
+               0,                      0,
+               DEVF_VIDEO64BIT | DEVF_CROSS4MB,
+               180000,
+               MGA_1064,
+               &vbMystique,
+               "Mystique (AGP)"},
+       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_MYS_AGP,   0xFF,
+               0,                      0,
+               DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB,
+               220000,
+               MGA_1164,
+               &vbMystique,
+               "Mystique 220 (AGP)"},
 #endif
 #ifdef CONFIG_FB_MATROX_G
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G100_MM,   0xFF,
@@ -1831,7 +1834,7 @@ static int initMatrox2(WPMINFO struct board* b){
        /* FIXME: Where to move this?! */
 #if defined(CONFIG_PPC_PMAC)
 #ifndef MODULE
-       if (_machine == _MACH_Pmac) {
+       if (machine_is(powermac)) {
                struct fb_var_screeninfo var;
                if (default_vmode <= 0 || default_vmode > VMODE_MAX)
                        default_vmode = VMODE_640_480_60;
@@ -1858,6 +1861,8 @@ static int initMatrox2(WPMINFO struct board* b){
                                                        to yres_virtual * xres_virtual < 2^32 */
        }
        matroxfb_init_fix(PMINFO2);
+       ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase));
+       matroxfb_update_fix(PMINFO2);
        /* Normalize values (namely yres_virtual) */
        matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon));
        /* And put it into "current" var. Do NOT program hardware yet, or we'll not take over
@@ -2010,11 +2015,11 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
        }
        /* not match... */
        if (!b->vendor)
-               return -1;
+               return -ENODEV;
        if (dev > 0) {
                /* not requested one... */
                dev--;
-               return -1;
+               return -ENODEV;
        }
        pci_read_config_dword(pdev, PCI_COMMAND, &cmd);
        if (pci_enable_device(pdev)) {