diff options
Diffstat (limited to 'src/ast_tool.c')
-rw-r--r-- | src/ast_tool.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/ast_tool.c b/src/ast_tool.c index 7a2165d..11d3085 100644 --- a/src/ast_tool.c +++ b/src/ast_tool.c @@ -67,10 +67,24 @@ ASTMapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - +#ifndef XSERVER_LIBPCIACCESS pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pAST->PciTag, pAST->FBPhysAddr, pAST->FbMapSize); +#else + { + void** result = (void**)&pAST->FBVirtualAddr; + int err = pci_device_map_range(pAST->PciInfo, + pAST->FBPhysAddr, + pAST->FbMapSize, + PCI_DEV_MAP_FLAG_WRITABLE | + PCI_DEV_MAP_FLAG_WRITE_COMBINE, + result); + + if (err) + return FALSE; + } +#endif if (!pAST->FBVirtualAddr) return FALSE; @@ -82,9 +96,13 @@ Bool ASTUnmapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - + +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr, pAST->FbMapSize); +#else + pci_device_unmap_range(pAST->PciInfo, pAST->FBVirtualAddr, pAST->FbMapSize); +#endif pAST->FBVirtualAddr = 0; @@ -97,15 +115,33 @@ ASTMapMMIO(ScrnInfoPtr pScrn) int mmioFlags; ASTRecPtr pAST = ASTPTR(pScrn); +#ifndef XSERVER_LIBPCIACCESS + #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; #else mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif + pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pAST->PciTag, pAST->MMIOPhysAddr, pAST->MMIOMapSize); + +#else + { + void** result = (void**)&pAST->MMIOVirtualAddr; + int err = pci_device_map_range(pAST->PciInfo, + pAST->MMIOPhysAddr, + pAST->MMIOMapSize, + PCI_DEV_MAP_FLAG_WRITABLE, + result); + + if (err) + return FALSE; + } + +#endif if (!pAST->MMIOVirtualAddr) return FALSE; @@ -117,8 +153,12 @@ ASTUnmapMMIO(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->MMIOVirtualAddr, pAST->MMIOMapSize); +#else + pci_device_unmap_range(pAST->PciInfo, pAST->MMIOVirtualAddr, pAST->MMIOMapSize); +#endif pAST->MMIOVirtualAddr = 0; } |