From f3d98022a0ad33a45c08a05af1789032fe6100dc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 18 Dec 2025 15:04:56 +0100 Subject: [PATCH] drop hacks for ancient pre-libpciaccess Xservers Signed-off-by: Enrico Weigelt, metux IT consult --- configure.ac | 16 ++------------- src/ast.h | 7 +------ src/ast_driver.c | 31 ------------------------------ src/ast_pcirename.h | 47 --------------------------------------------- src/ast_tool.c | 35 --------------------------------- 5 files changed, 3 insertions(+), 133 deletions(-) diff --git a/configure.ac b/configure.ac index dc1f1f9..66e1af0 100644 --- a/configure.ac +++ b/configure.ac @@ -59,20 +59,8 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto >= 7.0.22 fontsproto $REQUIRED_MODULES]) - -# Checks for libraries. -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" -AC_CHECK_DECL(XSERVER_LIBPCIACCESS, - [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], - [#include "xorg-server.h"]) -CPPFLAGS="$SAVE_CPPFLAGS" - -if test "x$XSERVER_LIBPCIACCESS" = xyes; then - PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) - XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" -fi -AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) +PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) +XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT diff --git a/src/ast.h b/src/ast.h index 94f3eb0..c71edc8 100644 --- a/src/ast.h +++ b/src/ast.h @@ -215,12 +215,7 @@ typedef struct _ASTPortPrivRec{ typedef struct _ASTRec { EntityInfoPtr pEnt; -#ifndef XSERVER_LIBPCIACCESS - pciVideoPtr PciInfo; - PCITAG PciTag; -#else - struct pci_device *PciInfo; -#endif + struct pci_device *PciInfo; OptionInfoPtr Options; DisplayModePtr ModePtr; diff --git a/src/ast_driver.c b/src/ast_driver.c index 464ed3b..c5c24b2 100644 --- a/src/ast_driver.c +++ b/src/ast_driver.c @@ -224,16 +224,6 @@ ASTProbe(DriverPtr drv, int flags) return FALSE; } -#ifndef XSERVER_LIBPCIACCESS - /* - * This probing is just checking the PCI data the server already - * collected. - */ - if (xf86GetPciVideoInfo() == NULL) { - return FALSE; - } -#endif - numUsed = xf86MatchPciInstances(AST_NAME, PCI_VENDOR_AST, ASTChipsets, ASTPciChipsets, devSections, numDevSections, @@ -251,7 +241,6 @@ ASTProbe(DriverPtr drv, int flags) for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; -#ifdef XSERVER_LIBPCIACCESS { struct pci_device *pPci = xf86GetPciInfoForEntity(usedChips[i]); @@ -266,7 +255,6 @@ ASTProbe(DriverPtr drv, int flags) return FALSE; } } -#endif /* Allocate new ScrnInfoRec and claim the slot */ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], @@ -378,11 +366,6 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) if (pEnt->location.type != BUS_PCI) return FALSE; -#ifndef XSERVER_LIBPCIACCESS - if (xf86RegisterResources(pEnt->index, 0, ResExclusive)) - return FALSE; -#endif - #if !(defined(__sparc__)) && !(defined(__mips__)) /* The vgahw module should be loaded here when needed */ if (!xf86LoadSubModule(pScrn, "vgahw")) @@ -436,10 +419,6 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->progClock = TRUE; pScrn->rgbBits = 6; pScrn->monitor = pScrn->confScreen->monitor; /* should be initialized before set gamma */ -#ifndef XSERVER_LIBPCIACCESS - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; - pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; -#endif /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -473,10 +452,6 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pAST = ASTPTR(pScrn); pAST->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); pAST->PciInfo = xf86GetPciInfoForEntity(pAST->pEnt->index); -#ifndef XSERVER_LIBPCIACCESS - pAST->PciTag = pciTag(pAST->PciInfo->bus, pAST->PciInfo->device, - pAST->PciInfo->func); -#endif /* Process the options * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities, @@ -746,12 +721,6 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) } #endif -#ifndef XSERVER_LIBPCIACCESS - /* We won't be using the VGA access after the probe */ - xf86SetOperatingState(resVgaIo, pAST->pEnt->index, ResUnusedOpr); - xf86SetOperatingState(resVgaMem, pAST->pEnt->index, ResDisableOpr); -#endif - return TRUE; } diff --git a/src/ast_pcirename.h b/src/ast_pcirename.h index 19144f6..cd16d61 100644 --- a/src/ast_pcirename.h +++ b/src/ast_pcirename.h @@ -34,51 +34,6 @@ enum region_type { REGION_IO }; -#ifndef XSERVER_LIBPCIACCESS - -/* pciVideoPtr */ -#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor) -#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->chipType) -#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->chipRev) - -#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subsysVendor) -#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subsysCard) - -#define PCI_DEV_TAG(_pcidev) pciTag((_pcidev)->bus, \ - (_pcidev)->device, \ - (_pcidev)->func) -#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) -#define PCI_DEV_DEV(_pcidev) ((_pcidev)->device) -#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) - -/* pciConfigPtr */ -#define PCI_CFG_TAG(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->tag) -#define PCI_CFG_BUS(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->busnum) -#define PCI_CFG_DEV(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->devnum) -#define PCI_CFG_FUNC(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->funcnum) - -/* region addr: xfree86 uses different fields for memory regions and I/O ports */ -#define PCI_REGION_BASE(_pcidev, _b, _type) \ - (((_type) == REGION_MEM) ? (_pcidev)->memBase[(_b)] \ - : (_pcidev)->ioBase[(_b)]) - -/* region size: xfree86 uses the log2 of the region size, - * but with zero meaning no region, not size of one XXX */ -#define PCI_REGION_SIZE(_pcidev, _b) \ - (((_pcidev)->size[(_b)] > 0) ? (1 << (_pcidev)->size[(_b)]) : 0) - -/* read/write PCI configuration space */ -#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ - *(_value_ptr) = pciReadByte(PCI_CFG_TAG(_pcidev), (_offset)) - -#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ - *(_value_ptr) = pciReadLong(PCI_CFG_TAG(_pcidev), (_offset)) - -#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ - pciWriteLong(PCI_CFG_TAG(_pcidev), (_offset), (_value)) - -#else /* XSERVER_LIBPCIACCESS */ - typedef struct pci_device *pciVideoPtr; #define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor_id) @@ -117,6 +72,4 @@ typedef struct pci_device *pciVideoPtr; #define PCI_WRITE_LONG(_pcidev, _value, _offset) \ pci_device_cfg_write_u32((_pcidev), (_value), (_offset)) -#endif /* XSERVER_LIBPCIACCESS */ - #endif /* ASTPCIRENAME_H */ diff --git a/src/ast_tool.c b/src/ast_tool.c index 628a58f..1c43990 100644 --- a/src/ast_tool.c +++ b/src/ast_tool.c @@ -53,11 +53,6 @@ ASTMapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); -#ifndef XSERVER_LIBPCIACCESS - pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pAST->PciTag, - pAST->FBPhysAddr, pAST->FbMapSize); -#else { void** result = (void**)&pAST->FBVirtualAddr; int err = pci_device_map_range(pAST->PciInfo, @@ -70,7 +65,6 @@ ASTMapMem(ScrnInfoPtr pScrn) if (err) return FALSE; } -#endif if (!pAST->FBVirtualAddr) return FALSE; @@ -83,12 +77,7 @@ ASTUnmapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); -#ifndef XSERVER_LIBPCIACCESS - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr, - pAST->FbMapSize); -#else pci_device_unmap_range(pAST->PciInfo, pAST->FBVirtualAddr, pAST->FbMapSize); -#endif pAST->FBVirtualAddr = 0; @@ -99,21 +88,7 @@ Bool ASTMapMMIO(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); -#ifndef XSERVER_LIBPCIACCESS - int mmioFlags; -#if !defined(__alpha__) - mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; -#else - mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; -#endif - - - pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pAST->PciTag, - pAST->MMIOPhysAddr, pAST->MMIOMapSize); - -#else { void** result = (void**)&pAST->MMIOVirtualAddr; int err = pci_device_map_range(pAST->PciInfo, @@ -126,7 +101,6 @@ ASTMapMMIO(ScrnInfoPtr pScrn) return FALSE; } -#endif if (!pAST->MMIOVirtualAddr) return FALSE; @@ -137,15 +111,6 @@ void ASTUnmapMMIO(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); - -#ifndef XSERVER_LIBPCIACCESS - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->MMIOVirtualAddr, - pAST->MMIOMapSize); -#else pci_device_unmap_range(pAST->PciInfo, pAST->MMIOVirtualAddr, pAST->MMIOMapSize); -#endif pAST->MMIOVirtualAddr = 0; - } - -