summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw
diff options
context:
space:
mode:
authordawes <dawes>2001-03-21 20:21:39 +0000
committerdawes <dawes>2001-03-21 20:21:39 +0000
commitc865af7afebd5d7c23ede46966653dff857770ee (patch)
treebb977d3b850918444d1d7598caf9744414f3c757 /xc/programs/Xserver/hw
parent10d2aa11e402d0aaa9f46526f97324a2de22848d (diff)
Modify the EnableBusMaster interface to make it fit in better. This
includes renaming it to xf86EnablePciBusMaster, changing the argument type to remove os-support layer dependencies, and adding an extra argument to make it possible for this interface to turn bus mastering off as well as on.
Diffstat (limited to 'xc/programs/Xserver/hw')
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86.h1
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c23
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/xf86sym.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h1
9 files changed, 22 insertions, 15 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h
index 3abc4cf8f..4ac59bcb2 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h
@@ -134,6 +134,7 @@ pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
char n, pciVideoPtr pvp_exclude);
pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
char n, pciVideoPtr pvp_exclude);
+void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable);
void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
#ifdef async
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
index d6d869656..f59f98723 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
@@ -2985,12 +2985,19 @@ pciConvertRange2Host(int entityIndex, resRange *pRange)
pciTagConvertRange2Host(tag, pRange);
}
-void
-xf86EnableBusMaster(PCITAG pcitag)
+void
+xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable)
{
- CARD32 temp;
-
- temp = pciReadLong(pcitag, PCI_CMD_STAT_REG);
- pciWriteLong(pcitag, PCI_CMD_STAT_REG,
- temp | PCI_CMD_MASTER_ENABLE);
-}
+ CARD32 temp;
+ PCITAG tag;
+
+ if (!pPci) return;
+
+ tag = pciTag(pPci->bus, pPci->device, pPci->func);
+ temp = pciReadLong(pcitag, PCI_CMD_STAT_REG);
+ if (enable)
+ pciWriteLong(pcitag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE);
+ else
+ pciWriteLong(pcitag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
index e33168311..99540edd2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c
@@ -576,7 +576,7 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen)
OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */
OUTREG(R128_AGP_CNTL, cntl);
- xf86EnableBusMaster(info->PciTag);
+ xf86EnablePciBusMaster(info->PciInfo, TRUE);
return TRUE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
index 704041d91..f2ff8ea94 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
@@ -859,7 +859,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen)
/* Enable bus mastering in PCI config
space */
- xf86EnableBusMaster(info->PciTag);
+ xf86EnablePciBusMaster(info->PciInfo, TRUE);
return TRUE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
index 2da9bb004..867bf3a68 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c
@@ -589,7 +589,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n",
pGlint->drmBufs->count);
- xf86EnableBusMaster(pGlint->PciTag);
+ xf86EnablePciBusMaster(pGlint->PciInfo, TRUE);
/* tell the generic kernel driver how to handle Gamma DMA */
if (pGlint->irq <= 0) {
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
index c8c1d34cf..cbe01717d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
@@ -684,7 +684,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n",
bufs, I810_DMA_BUF_SZ);
- xf86EnableBusMaster(pI810->PciTag);
+ xf86EnablePciBusMaster(pI810->PciInfo, TRUE);
I810InitDma(pScrn);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
index 09221b4aa..eafcf1ae7 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -750,7 +750,7 @@ static Bool MGADRIAgpInit(ScreenPtr pScreen)
"[drm] Added %d %d byte DMA buffers\n",
count, MGA_BUFFER_SIZE );
- xf86EnableBusMaster( pMga->PciTag );
+ xf86EnablePciBusMaster( pMga->PciInfo, TRUE );
return TRUE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
index 51d3bd81e..c420d9226 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
@@ -266,13 +266,13 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86FindScreenForEntity)
SYMFUNC(xf86FindPciDeviceVendor)
SYMFUNC(xf86FindPciClass)
+ SYMFUNC(xf86EnablePciBusMaster)
SYMFUNC(xf86RegisterStateChangeNotificationCallback)
SYMFUNC(xf86DeregisterStateChangeNotificationCallback)
SYMFUNC(xf86NoSharedResources)
#ifdef async
SYMFUNC(xf86QueueAsyncEvent)
#endif
- SYMFUNC(xf86EnableBusMaster)
/* Shared Accel Accessor Functions */
SYMFUNC(xf86GetLastScrnFlag)
SYMFUNC(xf86SetLastScrnFlag)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h
index 05daba5c7..ecdc009a6 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h
@@ -648,7 +648,6 @@ pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag,
int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg,
unsigned char *Buf, int Len);
pciConfigPtr *xf86scanpci(int flags);
-void xf86EnableBusMaster(PCITAG pcitag);
/* Old sytle PCI access functions (for compatibility) */
#if 0