Subject: xsrc/30520: Xfree86 mga driver panics the system on alpha
To: None <xsrc-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <e.e.dehling@student.utwente.nl>
List: netbsd-bugs
Date: 06/13/2005 22:31:00
>Number:         30520
>Category:       xsrc
>Synopsis:       Xfree86 mga driver panics the system on alpha
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 13 22:31:00 +0000 2005
>Originator:     Eike Dehling
>Release:        2.0.2
>Organization:
-
>Environment:
NetBSD pc164 2.0.2_BETA NetBSD 2.0.2_BETA (PC164) #0: Sat Apr  9 21:55:25 CEST 2005  root@pc164:/usr/src/sys/arch/alpha/compile/PC164 alpha
>Description:
The mga driver of XFree86 crashes the system on my AlphaPC 164SX.
>How-To-Repeat:
run startx as root on an alpha with a mga graphics card
>Fix:
--- xfree/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c       2005-06-14 00:16:15.000000000 +0200
+++ /root/mga_driver.c  2005-06-14 00:19:46.000000000 +0200
@@ -711,9 +711,6 @@
        pBios = &pMga->Bios;
        pBios2 = &pMga->Bios2;

-       /* Get the output mode set by the BIOS */
-       xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress + 0x7ff1u,
-                            sizeof(CARD8), &pMga->BiosOutputMode);

        /*
         * If the BIOS address was probed, it was found from the PCI config
@@ -725,6 +722,14 @@
        else if (pMga->BiosFrom == X_CONFIG && pMga->BiosAddress < 0x100000)
            pciBIOS = TRUE;

+       /* Get the output mode set by the BIOS */
+       if (pciBIOS)
+           xf86ReadPciBIOS(0, pMga->PciTag, pMga->FbBaseReg + 0x7ff1u,
+                       &pMga->BiosOutputMode, sizeof(CARD8));
+       else
+               xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress +
+                       0x7ff1u, sizeof(CARD8), &pMga->BiosOutputMode);
+
        if (pciBIOS)
            rlen = xf86ReadPciBIOS(0, pMga->PciTag, pMga->FbBaseReg,
                                   BIOS, sizeof(BIOS));