diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-09-14 23:10:09 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-09-14 23:10:09 +0200 |
commit | 485fb9aa1e5d90c75d763db4b7bf5a80e51e83e9 (patch) | |
tree | 53121f1d4f988979eea172c821d139905c2a541f /src | |
parent | d7f0f657504b2646a94f652baf0f71ff4117fac4 (diff) |
Use pci_device_map_range() instead of pci_device_map_region().
Likewise for pci_device_unmap_region().
Diffstat (limited to 'src')
-rw-r--r-- | src/mga_driver.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c index d9b786f..1ec20dd 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -2775,27 +2775,27 @@ MGAMapMem(ScrnInfoPtr pScrn) MGAPtr pMga = MGAPTR(pScrn); #ifdef XSERVER_LIBPCIACCESS struct pci_device *const dev = pMga->PciInfo; - int err; + struct pci_mem_region *region; + int i, err; #endif if (!pMga->FBDev) { #ifdef XSERVER_LIBPCIACCESS - err = pci_device_map_region(dev, 0, TRUE); - if (err) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unable to map BAR 0. %s (%d)\n", - strerror(err), err); - return FALSE; - } - - err = pci_device_map_region(dev, 1, TRUE); - if (err) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unable to map BAR 1. %s (%d)\n", - strerror(err), err); - return FALSE; - } + for (i = 0; i < 2; i++) { + region = &dev->regions[i]; + err = pci_device_map_range(dev, + region->base_addr, region->size, + PCI_DEV_MAP_FLAG_WRITABLE, + ®ion->memory); + + if (err) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unable to map BAR %i. %s (%d)\n", + i, strerror(err), err); + return FALSE; + } + } pMga->IOBase = dev->regions[ pMga->io_bar ].memory; pMga->FbBase = dev->regions[ pMga->framebuffer_bar ].memory; @@ -2839,7 +2839,11 @@ MGAMapMem(ScrnInfoPtr pScrn) pMga->ILOADBase = NULL; if (pMga->iload_bar != -1) { #ifdef XSERVER_LIBPCIACCESS - err = pci_device_map_region(dev, pMga->iload_bar, TRUE); + region = &dev->regions[pMga->iload_bar]; + err = pci_device_map_range(dev, + region->base_addr, region->size, + PCI_DEV_MAP_FLAG_WRITABLE, + ®ion->memory); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to map BAR 2 (ILOAD region). %s (%d)\n", @@ -2872,13 +2876,17 @@ MGAUnmapMem(ScrnInfoPtr pScrn) MGAPtr pMga = MGAPTR(pScrn); #ifdef XSERVER_LIBPCIACCESS struct pci_device * const dev = pMga->PciInfo; + struct pci_mem_region *region; + int i; #endif if (!pMga->FBDev) { #ifdef XSERVER_LIBPCIACCESS - pci_device_unmap_region(dev, 0); - pci_device_unmap_region(dev, 1); + for (i = 0; i < 2; i++) { + region = &dev->regions[i]; + pci_device_unmap_range(dev, region->memory, region->size); + } #else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize); @@ -2897,7 +2905,8 @@ MGAUnmapMem(ScrnInfoPtr pScrn) #endif ) { #ifdef XSERVER_LIBPCIACCESS - pci_device_unmap_region(dev, pMga->iload_bar); + region = &dev->regions[pMga->iload_bar]; + pci_device_unmap_range(dev, region->memory, region->size); #else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000); #endif |