summaryrefslogtreecommitdiff
path: root/src/mga_dri.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-08-22 10:43:39 -0700
committerIan Romanick <idr@us.ibm.com>2007-08-22 10:43:39 -0700
commit55d219394ad6af8e25ff604bcbb49d5a551bd348 (patch)
tree0a6c6e83a297e049d7a55abbeaaad61c61d9b53b /src/mga_dri.c
parentf4ef39d53d5a67942707507814fef4ad466dc909 (diff)
Merge PCI-rework support and "classic" PCI interface support into one tree
First pass at merging both trees. So far, this has only been tested on the PCI-rework build on a PCI G450.
Diffstat (limited to 'src/mga_dri.c')
-rw-r--r--src/mga_dri.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/mga_dri.c b/src/mga_dri.c
index bb2cc39..a8bea66 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -608,8 +608,8 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen)
xf86DrvMsg( pScreen->myNum, X_INFO,
"[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
mode, vendor, device,
- pMga->PciInfo->vendor_id,
- pMga->PciInfo->device_id );
+ VENDOR_ID(pMga->PciInfo),
+ DEVICE_ID(pMga->PciInfo));
if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) {
xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" );
@@ -756,7 +756,7 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen)
pMGADRIServer->registers.size = MGAIOMAPSIZE;
if ( drmAddMap( pMga->drmFD,
- (drm_handle_t)pMga->PciInfo->regions[ pMga->io_bar ].base_addr,
+ (drm_handle_t) MGA_IO_ADDRESS(pMga),
pMGADRIServer->registers.size,
DRM_REGISTERS, DRM_READ_ONLY,
&pMGADRIServer->registers.handle ) < 0 ) {
@@ -851,10 +851,17 @@ static void MGADRIIrqInit(MGAPtr pMga, ScreenPtr pScreen)
if (!pMga->irq) {
pMga->irq = drmGetInterruptFromBusID(pMga->drmFD,
+#ifdef PCIACCESS
((pMga->PciInfo->domain << 8) |
pMga->PciInfo->bus),
pMga->PciInfo->dev,
- pMga->PciInfo->func);
+ pMga->PciInfo->func
+#else
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum
+#endif
+ );
if((drmCtlInstHandler(pMga->drmFD, pMga->irq)) != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1153,10 +1160,15 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
} else {
pDRIInfo->busIdString = xalloc(64);
sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d",
- ((pMga->PciInfo->domain << 8) |
- pMga->PciInfo->bus),
- pMga->PciInfo->dev,
- pMga->PciInfo->func );
+#ifdef PCIACCESS
+ ((pMga->PciInfo->domain << 8) | pMga->PciInfo->bus),
+ pMga->PciInfo->dev, pMga->PciInfo->func
+#else
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum
+#endif
+ );
}
pDRIInfo->ddxDriverMajorVersion = PACKAGE_VERSION_MAJOR;
pDRIInfo->ddxDriverMinorVersion = PACKAGE_VERSION_MINOR;