summaryrefslogtreecommitdiff
path: root/src/ast_tool.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-03-10 11:53:07 +1000
committerDave Airlie <airlied@redhat.com>2008-03-10 11:53:07 +1000
commit88944bd72555056c10dfcf87eb1a98c9ecf704bc (patch)
tree0dd958cbd585d0b38a7a69b74e38f539b6c92ac3 /src/ast_tool.c
parentcbf726c635280ea79524e94d6e993ed29c647bd2 (diff)
ast: pciaccess conversion
Diffstat (limited to 'src/ast_tool.c')
-rw-r--r--src/ast_tool.c44
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;
}