From: Ondrej Zary <[email protected]>

https://bugs.freedesktop.org/show_bug.cgi?id=28249

ark driver does not work with Hercules Stingray 64 card (ark2000pv).
X fails to start with:

[...]
(II) ark(0): vgaHWGetIOBase: hwp->IOBase is 0x03d0, hwp->PIOOffset is
0x0000
(II) ark(0): Creating default Display subsection in Screen section
        "Default Screen Section" for depth/fbbpp 24/32
(==) ark(0): Depth 24, (--) framebuffer bpp 32
(==) ark(0): RGB weight 888
(==) ark(0): Default visual is TrueColor
(**) ark(0): Chipset: "ark2000pv"
(--) ark(0): Framebuffer @ 0xe5e50000
(==) ark(0): Using gamma correction (1.0, 1.0, 1.0)
(--) ark(0): Detected 2048 bytes video ram
[...]
Fatal server error:
AddScreen/ScreenInit failed for driver 0

Comparing with lspci, the framebuffer address is wrong:
00:0f.0 VGA compatible controller: ARK Logic Inc 2000PV [Stingray] (prog-if 00 
[VGA controller])
        Flags: medium devsel
        Memory at e5000000 (32-bit, prefetchable) [size=4M]
        [virtual] Expansion ROM at 1c000000 [disabled] [size=64K]
---
 src/ark.h        |    1 -
 src/ark_driver.c |   30 +++++++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/ark.h b/src/ark.h
index de301dc..077f93b 100644
--- a/src/ark.h
+++ b/src/ark.h
@@ -34,7 +34,6 @@ typedef struct _ARKRec {
 #endif
        EntityInfoPtr           pEnt;
        CARD32                  IOAddress;
-       CARD32                  FBAddress;
        unsigned char *         FBBase;
        unsigned char *         MMIOBase;
        unsigned long           videoRam;
diff --git a/src/ark_driver.c b/src/ark_driver.c
index 5de3b9a..fec3e1a 100644
--- a/src/ark_driver.c
+++ b/src/ark_driver.c
@@ -363,14 +363,14 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags)
        outb(hwp->PIOOffset + hwp->IOBase + 5, tmp & 0x7f);
        modinx(hwp->PIOOffset + 0x3c4, 0x1d, 0x01, 0x01);
 
-       /* use membase's later on ??? */
-       pARK->FBAddress = (rdinx(hwp->PIOOffset + 0x3c4, 0x13) << 16) +
-                         (rdinx(hwp->PIOOffset + 0x3c4, 0x14) << 24);
-
-       pScrn->memPhysBase = pARK->FBAddress;
+#ifndef XSERVER_LIBPCIACCESS
+       pScrn->memPhysBase = pARK->PciInfo->memBase[0];
+#else
+       pScrn->memPhysBase = pARK->PciInfo->regions[0].base_addr;
+#endif
 
        xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%lx\n",
-                  (unsigned long)pARK->FBAddress);
+                  (unsigned long)pScrn->memPhysBase);
 
        if (!xf86SetGamma(pScrn, gzeros))
                return FALSE;
@@ -748,8 +748,13 @@ static Bool ARKModeInit(ScrnInfoPtr pScrn, DisplayModePtr 
mode)
        new->sr10 = rdinx(isaIOBase + 0x3c4, 0x10) & ~0x1f;
        new->sr10 |= 0x1f;
 
-       new->sr13 = pARK->FBAddress >> 16;
-       new->sr14 = pARK->FBAddress >> 24;
+#ifndef XSERVER_LIBPCIACCESS
+       new->sr13 = pARK->PciInfo->memBase[0] >> 16;
+       new->sr14 = pARK->PciInfo->memBase[0] >> 24;
+#else
+       new->sr13 = pARK->PciInfo->regions[0].base_addr >> 16;
+       new->sr14 = pARK->PciInfo->regions[0].base_addr >> 24;
+#endif
 
        new->sr12 = rdinx(isaIOBase + 0x3c4, 0x12) & ~0x03;
        switch (pScrn->videoRam) {
@@ -1022,7 +1027,7 @@ static Bool ARKMapMem(ScrnInfoPtr pScrn)
                                             pARK->PciTag, 0xb8000, 0x8000);
 
        pARK->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
-                                    pARK->PciTag, pARK->FBAddress,
+                                    pARK->PciTag, pARK->PciInfo->memBase[0],
                                     pScrn->videoRam * 1024);
 #else
 
@@ -1032,14 +1037,17 @@ static Bool ARKMapMem(ScrnInfoPtr pScrn)
        {
                void** result = (void**)&pARK->FBBase;
                int err = pci_device_map_range(pARK->PciInfo,
-                                              pARK->FBAddress,
+                                              
pARK->PciInfo->regions[0].base_addr,
                                               pScrn->videoRam * 1024,
                                               PCI_DEV_MAP_FLAG_WRITABLE |
                                               PCI_DEV_MAP_FLAG_WRITE_COMBINE,
                                               result);
                
-               if (err) 
+               if (err) {
+                       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                          "Cound not map framebuffer: %d\n", err);
                        return FALSE;
+               }
        }
 #endif
 
-- 
1.7.2.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to