summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-10-03 12:47:59 -0700
committerIan Romanick <idr@us.ibm.com>2007-10-03 12:47:59 -0700
commit8e971287f60f3a41f2d0d176e4eaaa653e25276b (patch)
tree7563d4fe43a1e1d81e96586ad329f42b5d799f6e
parent10d452ad86b4798f3ded6c4c2446f08aaab6af00 (diff)
Unmap the same size that was mapped
Make sure the same size is used with pci_device_unmap_range as was used with pci_device_map_range. Failing to do so was causing problems with a G450 card in a POWER6 box. Based on a patch submitted by Anton Blanchard.
-rw-r--r--src/mga_driver.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c
index c881b9d..0185b9b 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2880,8 +2880,10 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
if (!pMga->FBDev) {
#ifdef XSERVER_LIBPCIACCESS
- pci_device_unmap_range(dev, pMga->IOBase, 0x4000);
- pci_device_unmap_range(dev, pMga->FbBase, pMga->FbMapSize);
+ pci_device_unmap_range(dev, pMga->IOBase,
+ dev->regions[pMga->io_bar].size);
+ pci_device_unmap_range(dev, pMga->FbBase,
+ dev->regions[pMga->fb_bar].size);
#else
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize);
@@ -2894,7 +2896,8 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) {
#ifdef XSERVER_LIBPCIACCESS
- pci_device_unmap_range(dev, pMga->ILOADBase, 0x800000);
+ pci_device_unmap_range(dev, pMga->ILOADBase,
+ dev->regions[pMga->iload_bar].size);
#else
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000);
#endif