From 923176f5aad777b4023003a457bb77da21373389 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 31 Aug 2007 11:05:57 -0700 Subject: Use XSERVER_LIBPCIACCESS to detect pci-rework. --- configure.ac | 24 +++++++++++------------ src/clientlx.c | 8 ++++---- src/mga.h | 8 ++++---- src/mga_bios.c | 4 ++-- src/mga_dac3026.c | 4 ++-- src/mga_dacG.c | 6 +++--- src/mga_dri.c | 4 ++-- src/mga_driver.c | 58 +++++++++++++++++++++++++++---------------------------- src/mga_macros.h | 2 +- src/mga_merge.c | 4 ++-- 10 files changed, 61 insertions(+), 61 deletions(-) diff --git a/configure.ac b/configure.ac index 7d37153..1605dee 100644 --- a/configure.ac +++ b/configure.ac @@ -60,11 +60,6 @@ AC_ARG_ENABLE(exa, [Disable EXA support [[default=enabled]]]), [EXA="$enableval"], [EXA=yes]) -AC_ARG_ENABLE(pciaccess, - AS_HELP_STRING([--enable-pciaccess], - [Enable use of libpciaccess (default: disabled)]), - [PCIACCESS=$enableval], - [PCIACCESS=no]) # Checks for extensions XORG_DRIVER_CHECK_EXT(RANDR, randrproto) @@ -76,13 +71,6 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) PKG_CHECK_MODULES(XORG, [xorg-server >= 1.1.0 xproto fontsproto $REQUIRED_MODULES]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) -AM_CONDITIONAL(PCIACCESS, [test "x$PCIACCESS" = xyes]) -if test "x$PCIACCESS" = xyes; then - AC_DEFINE(PCIACCESS, 1, [Use libpciaccess]) - PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.7.0]) - XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" -fi - # Checks for libraries. # Checks for header files. @@ -116,6 +104,18 @@ if test "x$DRI" = xyes; then AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) fi +save_CFLAGS="$CFLAGS" +CFLAGS="$XORG_CFLAGS" +AC_CHECK_DECL(XSERVER_LIBPCIACCESS, + [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no], + [#include "xorg-server.h"]) +CFLAGS="$save_CFLAGS" + +if test "x$XSERVER_LIBPCIACCESS" = xyes; then + PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) +fi +AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) + AM_CONDITIONAL(USE_XAA, true) AC_DEFINE(USE_XAA, 1, [Build support for XAA]) diff --git a/src/clientlx.c b/src/clientlx.c index 8c08026..9c6ab50 100644 --- a/src/clientlx.c +++ b/src/clientlx.c @@ -67,7 +67,7 @@ ULONG ClientReadConfigSpaceByte(LPBOARDHANDLE pBoard, ULONG ulOffset, ASSERT_HANDLER(pBoard); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u8(pMga->PciInfo, pucByte, ulOffset); #else *pucByte = pciReadByte(pMga->PciTag,ulOffset); @@ -99,7 +99,7 @@ ULONG ClientReadConfigSpaceDword(LPBOARDHANDLE pBoard, ULONG ulOffset, ASSERT_HANDLER(pBoard); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *) pulDword, ulOffset); #else *pulDword = pciReadLong(pMga->PciTag,ulOffset); @@ -131,7 +131,7 @@ ULONG ClientWriteConfigSpaceByte(LPBOARDHANDLE pBoard, ULONG ulOffset, ASSERT_HANDLER(pBoard); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_u8(pMga->PciInfo, ucByte, ulOffset); #else pciWriteByte(pMga->PciTag,ulOffset, ucByte); @@ -163,7 +163,7 @@ ULONG ClientWriteConfigSpaceDword(LPBOARDHANDLE pBoard, ULONG ulOffset, ASSERT_HANDLER(pBoard); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_u32(pMga->PciInfo, (uint32_t) ulDword, ulOffset); #else pciWriteLong(pMga->PciTag,ulOffset, ulDword); diff --git a/src/mga.h b/src/mga.h index 673ec1d..c46fdbb 100644 --- a/src/mga.h +++ b/src/mga.h @@ -14,7 +14,7 @@ #ifndef MGA_H #define MGA_H -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS #include #endif #include @@ -289,7 +289,7 @@ typedef struct { #ifdef DISABLE_VGA_IO typedef struct mgaSave { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS struct pci_device * pvp; #else pciVideoPtr pvp; @@ -441,7 +441,7 @@ typedef struct { EntityInfoPtr pEnt; struct mga_bios_values bios; CARD8 BiosOutputMode; -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS struct pci_device * PciInfo; #else pciVideoPtr PciInfo; @@ -482,7 +482,7 @@ typedef struct { */ int iload_bar; -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS unsigned long IOAddress; unsigned long ILOADAddress; unsigned long BiosAddress; diff --git a/src/mga_bios.c b/src/mga_bios.c index 46a8c46..aece217 100644 --- a/src/mga_bios.c +++ b/src/mga_bios.c @@ -409,7 +409,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn ) CARD8 bios_data[0x20000]; unsigned offset; MGAPtr pMga = MGAPTR(pScrn); -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS Bool pciBIOS = TRUE; #endif int rlen; @@ -446,7 +446,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn ) * might be controlled by the PCI config space. */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS err = pci_device_read_rom(pMga->PciInfo, bios_data); #else if (pMga->BiosFrom == X_DEFAULT) { diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index 254f6e2..e33f914 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -746,7 +746,7 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, for (i = 0; i < 6; i++) OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, OPTION_MASK, mgaReg->Option, PCI_OPTION_REG); #else @@ -871,7 +871,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, for (i = 0; i < DACREGSIZE; i++) mgaReg->DacRegs[i] = inTi3026(MGADACregs[i]); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option, PCI_OPTION_REG); #else diff --git a/src/mga_dacG.c b/src/mga_dacG.c index f135ad5..1a6a565 100644 --- a/src/mga_dacG.c +++ b/src/mga_dacG.c @@ -771,7 +771,7 @@ MGA_NOT_HAL( if (!MGAISGx50(pMga)) { /* restore pci_option register */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, optionMask, mgaReg->Option, PCI_OPTION_REG); @@ -960,7 +960,7 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, mgaReg->PIXPLLCSaved = TRUE; -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option, PCI_OPTION_REG); pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option2, @@ -971,7 +971,7 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, mgaReg->Option2 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION2); #endif if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550) -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option3, PCI_MGA_OPTION3); #else diff --git a/src/mga_dri.c b/src/mga_dri.c index a8bea66..43fcaa8 100644 --- a/src/mga_dri.c +++ b/src/mga_dri.c @@ -851,7 +851,7 @@ static void MGADRIIrqInit(MGAPtr pMga, ScreenPtr pScreen) if (!pMga->irq) { pMga->irq = drmGetInterruptFromBusID(pMga->drmFD, -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS ((pMga->PciInfo->domain << 8) | pMga->PciInfo->bus), pMga->PciInfo->dev, @@ -1160,7 +1160,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) } else { pDRIInfo->busIdString = xalloc(64); sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d", -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS ((pMga->PciInfo->domain << 8) | pMga->PciInfo->bus), pMga->PciInfo->dev, pMga->PciInfo->func #else diff --git a/src/mga_driver.c b/src/mga_driver.c index 927e9a4..d9b786f 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -64,7 +64,7 @@ #include "xf86PciInfo.h" /* Drivers that need to access the PCI config space directly need this */ -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS #include "xf86Pci.h" #endif @@ -111,7 +111,7 @@ /* Mandatory functions */ static const OptionInfoRec * MGAAvailableOptions(int chipid, int busid); static void MGAIdentify(int flags); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS static Bool MGAPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, intptr_t match_data); #else @@ -192,7 +192,7 @@ static const struct mga_device_attributes attribs[8] = { (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION) }, }; -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS #define MGA_DEVICE_MATCH(d, i) \ { 0x102B, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) } #define MGA_SUBDEVICE_MATCH(d, s, i) \ @@ -264,7 +264,7 @@ _X_EXPORT DriverRec MGA_C_NAME = { MGA_VERSION, MGA_DRIVER_NAME, MGAIdentify, -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS NULL, #else MGAProbe, @@ -274,7 +274,7 @@ _X_EXPORT DriverRec MGA_C_NAME = { 0, NULL, -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS mga_device_match, MGAPciProbe #endif @@ -635,7 +635,7 @@ MGAIdentify(int flags) } -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS Bool MGAPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, intptr_t match_data) @@ -978,7 +978,7 @@ MGACountRam(ScrnInfoPtr pScrn) it. At least, my cards don't advertise the documented values (my 8 and 16 Meg G200s have the same values) */ if (pMga->Primary) { /* can only trust this for primary cards */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & biosInfo, PCI_OPTION_REG); #else @@ -1289,7 +1289,7 @@ static void VgaIOSave(int i, void *arg) { MgaSavePtr sMga = arg; -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS PCITAG tag = pciTag(sMga->pvp->bus,sMga->pvp->device,sMga->pvp->func); #endif uint32_t temp; @@ -1298,7 +1298,7 @@ VgaIOSave(int i, void *arg) ErrorF("mga: VgaIOSave: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device, sMga->pvp->func); #endif -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & temp, PCI_OPTION_REG); #else temp = pciReadLong(tag, PCI_OPTION_REG); @@ -1310,7 +1310,7 @@ static void VgaIORestore(int i, void *arg) { MgaSavePtr sMga = arg; -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS PCITAG tag = pciTag(sMga->pvp->bus,sMga->pvp->device,sMga->pvp->func); #endif @@ -1318,7 +1318,7 @@ VgaIORestore(int i, void *arg) ErrorF("mga: VgaIORestore: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device, sMga->pvp->func); #endif -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, sMga->enable, PCI_OPTION_REG); #else @@ -1338,7 +1338,7 @@ VgaIODisable(void *arg) BOOLTOSTRING(xf86ResAccessEnter)); #endif /* Turn off the vgaioen bit. */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, 0x00000000, PCI_OPTION_REG); #else @@ -1359,7 +1359,7 @@ VgaIOEnable(void *arg) #endif /* Turn on the vgaioen bit. */ if (pMga->Primary) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, 0x00000100, PCI_OPTION_REG); #else @@ -1479,7 +1479,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (!vgaHWGetHWRec(pScrn)) return FALSE; -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS /* Find the PCI info for this screen */ pMga->PciInfo = xf86GetPciInfoForEntity(pMga->pEnt->index); pMga->PciTag = pciTag(pMga->PciInfo->bus, pMga->PciInfo->device, @@ -1731,7 +1731,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (pMga->is_G200SE) { /* Disable MTRR support on PCIe systems */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS uint32_t temp; pci_device_cfg_read_u32(pMga->PciInfo, & temp, 0xDC); @@ -2022,7 +2022,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pMga->FbAddress = pMga->PciInfo->regions[pMga->framebuffer_bar].base_addr; #else pMga->FbAddress = pMga->PciInfo->memBase[pMga->framebuffer_bar] & 0xff800000; @@ -2031,7 +2031,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n", (unsigned long)pMga->FbAddress); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO registers at 0x%lX\n", (unsigned long) pMga->PciInfo->regions[pMga->io_bar].base_addr); #else @@ -2042,7 +2042,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) #endif if (pMga->iload_bar != -1) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pseudo-DMA transfer window at 0x%lX\n", (unsigned long) pMga->PciInfo->regions[pMga->iload_bar].base_addr); @@ -2057,7 +2057,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS /* * Find the BIOS base. Get it from the PCI config if possible. Otherwise * use the VGA default. Allow the config file to override this. @@ -2096,7 +2096,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * Read the BIOS data struct */ -#if defined(__alpha__) && !defined(PCIACCESS) +#if defined(__alpha__) && !defined(XSERVER_LIBPCIACCESS) /* * Some old Digital-OEMed Matrox Millennium I cards have a VGA * disable switch. If the disable is on, we can't read the BIOS, @@ -2509,7 +2509,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) && pMga->chip_attribs->probe_for_sdram) { uint32_t option_reg; -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, & option_reg, PCI_OPTION_REG); #else @@ -2773,14 +2773,14 @@ static Bool MGAMapMem(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS struct pci_device *const dev = pMga->PciInfo; int err; #endif if (!pMga->FBDev) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS err = pci_device_map_region(dev, 0, TRUE); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -2838,7 +2838,7 @@ MGAMapMem(ScrnInfoPtr pScrn) pMga->ILOADBase = NULL; if (pMga->iload_bar != -1) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS err = pci_device_map_region(dev, pMga->iload_bar, TRUE); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -2870,13 +2870,13 @@ static Bool MGAUnmapMem(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS struct pci_device * const dev = pMga->PciInfo; #endif if (!pMga->FBDev) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_unmap_region(dev, 0); pci_device_unmap_region(dev, 1); #else @@ -2890,13 +2890,13 @@ MGAUnmapMem(ScrnInfoPtr pScrn) } if ((pMga->iload_bar != -1) -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS && (dev->regions[pMga->iload_bar].memory != NULL) #else && (pMga->ILOADBase != NULL) #endif ) { -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_unmap_region(dev, pMga->iload_bar); #else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000); @@ -3540,7 +3540,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) else { fbdevHWSave(pScrn); /* Disable VGA core, and leave memory access on */ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, 0x00000000, PCI_OPTION_REG); #else diff --git a/src/mga_macros.h b/src/mga_macros.h index 3de9618..69dc8e3 100644 --- a/src/mga_macros.h +++ b/src/mga_macros.h @@ -3,7 +3,7 @@ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ -#ifdef PCIACCESS +#ifdef XSERVER_LIBPCIACCESS #define MGA_IO_ADDRESS(p) (p)->PciInfo->regions[(p)->io_bar].base_addr #define VENDOR_ID(p) (p)->vendor_id #define DEVICE_ID(p) (p)->device_id diff --git a/src/mga_merge.c b/src/mga_merge.c index 141b0c3..359cdcf 100644 --- a/src/mga_merge.c +++ b/src/mga_merge.c @@ -272,7 +272,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) return TRUE; } -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS pMga->PciTag = pMga1->PciTag; #endif pMga->Primary = pMga1->Primary; @@ -372,7 +372,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) pMga->FbAddress = pMga1->FbAddress; pMga->PciInfo = pMga1->PciInfo; -#ifndef PCIACCESS +#ifndef XSERVER_LIBPCIACCESS pMga->IOAddress = pMga1->IOAddress; pMga->ILOADAddress = pMga1->ILOADAddress; pMga->BiosFrom = pMga1->BiosFrom; -- cgit v1.2.3