mirror of
https://github.com/X11Libre/xf86-video-xgi.git
synced 2026-03-24 01:24:35 +00:00
drop hacks for ancient pre-libpciaccess Xservers
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
14
configure.ac
14
configure.ac
@@ -103,19 +103,7 @@ if test "x$DRI" = xyes; then
|
||||
AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
|
||||
fi
|
||||
|
||||
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])
|
||||
fi
|
||||
AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
|
||||
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
||||
|
||||
AC_SUBST([moduledir])
|
||||
AC_DEFINE_UNQUOTED(XGI_RELEASE_DATE, ["$RELEASE_DATE"], [Driver release])
|
||||
|
||||
16
src/xgi.h
16
src/xgi.h
@@ -133,11 +133,7 @@ extern Bool g_bRunTimeDebug;
|
||||
#define PACCELDEBUG(p)
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#include <pciaccess.h>
|
||||
#else
|
||||
#include "xf86Pci.h"
|
||||
#endif
|
||||
#include "xf86Cursor.h"
|
||||
#include "xf86xv.h"
|
||||
#include "compiler.h"
|
||||
@@ -174,17 +170,10 @@ extern Bool g_bRunTimeDebug;
|
||||
#include "xgi_dri.h"
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#define VENDOR_ID(p) (p)->vendor_id
|
||||
#define DEVICE_ID(p) (p)->device_id
|
||||
#define SUBSYS_ID(p) (p)->subdevice_id
|
||||
#define CHIP_REVISION(p) (p)->revision
|
||||
#else
|
||||
#define VENDOR_ID(p) (p)->vendor
|
||||
#define DEVICE_ID(p) (p)->chipType
|
||||
#define SUBSYS_ID(p) (p)->subsysCard
|
||||
#define CHIP_REVISION(p) (p)->chipRev
|
||||
#endif
|
||||
|
||||
#define XGI_XINERAMA_MAJOR_VERSION 1
|
||||
#define XGI_XINERAMA_MINOR_VERSION 1
|
||||
@@ -519,12 +508,7 @@ typedef struct MonitorRange {
|
||||
|
||||
typedef struct {
|
||||
ScrnInfoPtr pScrn; /* -------------- DON'T INSERT ANYTHING HERE --------------- */
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
struct pci_device * PciInfo;
|
||||
#else
|
||||
pciVideoPtr PciInfo; /* -------- OTHERWISE xgi_dri.so MUST BE RECOMPILED -------- */
|
||||
PCITAG PciTag;
|
||||
#endif
|
||||
EntityInfoPtr pEnt;
|
||||
int Chipset;
|
||||
int ChipRev;
|
||||
|
||||
@@ -339,16 +339,10 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen)
|
||||
|
||||
/* enable IRQ */
|
||||
pXGI->irq = drmGetInterruptFromBusID(pXGI->drmSubFD,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
((pXGI->PciInfo->domain << 8)
|
||||
| pXGI->PciInfo->bus),
|
||||
pXGI->PciInfo->dev,
|
||||
pXGI->PciInfo->func
|
||||
#else
|
||||
((pciConfigPtr)pXGI->PciInfo->thisCard)->busnum,
|
||||
((pciConfigPtr)pXGI->PciInfo->thisCard)->devnum,
|
||||
((pciConfigPtr)pXGI->PciInfo->thisCard)->funcnum
|
||||
#endif
|
||||
);
|
||||
|
||||
if((drmCtlInstHandler(pXGI->drmSubFD, pXGI->irq)) != 0)
|
||||
@@ -485,34 +479,6 @@ XGIDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
|
||||
Volari_Idle(pXGI);
|
||||
}
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
/**
|
||||
* Use this function to check AGP slot
|
||||
*/
|
||||
ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
|
||||
{
|
||||
ULONG uBuffer = 0, uLink = 0, uValue = 0 ;
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
XGIPtr pXGI = XGIPTR(pScrn);
|
||||
|
||||
uBuffer = pciReadLong(pXGI->PciTag, uNextLink);
|
||||
uLink = (uBuffer & 0xff00) >> 8;
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s]uBuffer=0x%lx uNextLink=0x%lx, uLink=0x%lx\n", __FUNCTION__, uBuffer, uNextLink, uLink);
|
||||
|
||||
if ((uBuffer & 0xff) != 0x02)
|
||||
{
|
||||
if(uLink)
|
||||
uValue = CheckAGPSlot(pScreen, uLink);
|
||||
else
|
||||
uValue = PCI_BUS_TYPE;
|
||||
}
|
||||
else
|
||||
uValue = AGP_BUS_TYPE;
|
||||
|
||||
return uValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Use this function to check if the current card is AGP or PCI.
|
||||
*/
|
||||
@@ -521,38 +487,8 @@ ULONG IsXGIAGPCard(ScreenPtr pScreen)
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
XGIPtr pXGI = XGIPTR(pScrn);
|
||||
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
const struct pci_agp_info *agp_info =
|
||||
pci_device_get_agp_info(pXGI->PciInfo);
|
||||
|
||||
return (agp_info == NULL) ? PCI_BUS_TYPE : AGP_BUS_TYPE;
|
||||
#else
|
||||
ULONG u34h = pciReadLong(pXGI->PciTag,0x34);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] u34h=0x%lx\n", __FUNCTION__, u34h);
|
||||
|
||||
/* This value is read only and the default value should be 0x40;
|
||||
* I have no idea why I should do this */
|
||||
ULONG uLink = u34h & 0xff;
|
||||
|
||||
if (0 == uLink)
|
||||
{
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] No Next ID, This is a PCI card\n", __FUNCTION__);
|
||||
return PCI_BUS_TYPE;
|
||||
}
|
||||
|
||||
ULONG uType = 0;
|
||||
uType = CheckAGPSlot(pScreen, uLink);
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] This Card Type is %ld \n", __FUNCTION__, uType);
|
||||
|
||||
if (uType == PCI_BUS_TYPE)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] This Card Type is PCI\n", __FUNCTION__);
|
||||
if (uType == AGP_BUS_TYPE)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] This Card Type is AGP\n", __FUNCTION__);
|
||||
if (uType == PCIE_BUS_TYPE)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] This Card Type is PCIExpress\n", __FUNCTION__);
|
||||
|
||||
return uType;
|
||||
#endif
|
||||
}
|
||||
|
||||
285
src/xgi_driver.c
285
src/xgi_driver.c
@@ -99,12 +99,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static Bool XGIPciProbe(DriverPtr drv, int entity_num,
|
||||
struct pci_device *dev, intptr_t match_data);
|
||||
#else
|
||||
static Bool XGIProbe(DriverPtr drv, int flags);
|
||||
#endif
|
||||
|
||||
void Volari_EnableAccelerator(ScrnInfoPtr pScrn);
|
||||
/* Globals (yes, these ARE really required to be global) */
|
||||
@@ -152,7 +148,6 @@ struct fb_fix_screeninfo
|
||||
unsigned short reserved[3]; /* Reserved for future compatibility */
|
||||
};
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#define XGI_DEVICE_MATCH(d, i) \
|
||||
{ 0x18ca, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
|
||||
|
||||
@@ -163,7 +158,6 @@ static const struct pci_id_match xgi_device_match[] = {
|
||||
XGI_DEVICE_MATCH(PCI_CHIP_XGIXG27, 3),
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This contains the functions needed by the server after loading the driver
|
||||
@@ -177,20 +171,13 @@ DriverRec XGI = {
|
||||
XGI_CURRENT_VERSION,
|
||||
XGI_DRIVER_NAME,
|
||||
XGIIdentify,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
NULL,
|
||||
#else
|
||||
XGIProbe,
|
||||
#endif
|
||||
XGIAvailableOptions,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
xgi_device_match,
|
||||
XGIPciProbe
|
||||
#endif
|
||||
};
|
||||
|
||||
static SymTabRec XGIChipsets[] = {
|
||||
@@ -582,7 +569,6 @@ XGIErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
|
||||
}
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static Bool XGIPciProbe(DriverPtr drv, int entity_num,
|
||||
struct pci_device *dev, intptr_t match_data)
|
||||
{
|
||||
@@ -620,114 +606,6 @@ static Bool XGIPciProbe(DriverPtr drv, int entity_num,
|
||||
return (pScrn != NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Mandatory */
|
||||
static Bool
|
||||
XGIProbe(DriverPtr drv, int flags)
|
||||
{
|
||||
int i;
|
||||
GDevPtr *devSections;
|
||||
int *usedChips;
|
||||
int numDevSections;
|
||||
int numUsed;
|
||||
Bool foundScreen = FALSE;
|
||||
|
||||
/*
|
||||
* The aim here is to find all cards that this driver can handle,
|
||||
* and for the ones not already claimed by another driver, claim the
|
||||
* slot, and allocate a ScrnInfoRec.
|
||||
*
|
||||
* This should be a minimal probe, and it should under no circumstances
|
||||
* change the state of the hardware. Because a device is found, don't
|
||||
* assume that it will be used. Don't do any initialisations other than
|
||||
* the required ScrnInfoRec initialisations. Don't allocate any new
|
||||
* data structures.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Next we check, if there has been a chipset override in the config file.
|
||||
* For this we must find out if there is an active device section which
|
||||
* is relevant, i.e., which has no driver specified or has THIS driver
|
||||
* specified.
|
||||
*/
|
||||
|
||||
if ((numDevSections =
|
||||
xf86MatchDevice(XGI_DRIVER_NAME, &devSections)) <= 0) {
|
||||
/*
|
||||
* There's no matching device section in the config file, so quit
|
||||
* now.
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PDEBUG(ErrorF(" --- XGIProbe \n"));
|
||||
/*
|
||||
* We need to probe the hardware first. We then need to see how this
|
||||
* fits in with what is given in the config file, and allow the config
|
||||
* file info to override any contradictions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* All of the cards this driver supports are PCI, so the "probing" just
|
||||
* amounts to checking the PCI data that the server has already collected.
|
||||
*/
|
||||
if (xf86GetPciVideoInfo() == NULL) {
|
||||
/*
|
||||
* We won't let anything in the config file override finding no
|
||||
* PCI video cards at all. This seems reasonable now, but we'll see.
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
numUsed = xf86MatchPciInstances(XGI_NAME, PCI_VENDOR_XGI,
|
||||
XGIChipsets, XGIPciChipsets, devSections,
|
||||
numDevSections, drv, &usedChips);
|
||||
|
||||
/* Free it since we don't need that list after this */
|
||||
free(devSections);
|
||||
if (numUsed <= 0)
|
||||
return FALSE;
|
||||
|
||||
if (flags & PROBE_DETECT) {
|
||||
foundScreen = TRUE;
|
||||
}
|
||||
else
|
||||
for (i = 0; i < numUsed; i++) {
|
||||
ScrnInfoPtr pScrn;
|
||||
EntityInfoPtr pEnt;
|
||||
|
||||
/* Allocate a ScrnInfoRec and claim the slot */
|
||||
pScrn = NULL;
|
||||
|
||||
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
|
||||
XGIPciChipsets, NULL, NULL,
|
||||
NULL, NULL, NULL))) {
|
||||
/* Fill in what we can of the ScrnInfoRec */
|
||||
pScrn->driverVersion = XGI_CURRENT_VERSION;
|
||||
pScrn->driverName = XGI_DRIVER_NAME;
|
||||
pScrn->name = XGI_NAME;
|
||||
pScrn->Probe = XGIProbe;
|
||||
pScrn->PreInit = XGIPreInit;
|
||||
pScrn->ScreenInit = XGIScreenInit;
|
||||
pScrn->SwitchMode = XGISwitchMode;
|
||||
pScrn->AdjustFrame = XGIAdjustFrame;
|
||||
pScrn->EnterVT = XGIEnterVT;
|
||||
pScrn->LeaveVT = XGILeaveVT;
|
||||
pScrn->FreeScreen = XGIFreeScreen;
|
||||
pScrn->ValidMode = XGIValidMode;
|
||||
foundScreen = TRUE;
|
||||
}
|
||||
pEnt = xf86GetEntityInfo(usedChips[i]);
|
||||
}
|
||||
free(usedChips);
|
||||
|
||||
return foundScreen;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Some helper functions for MergedFB mode */
|
||||
|
||||
/* Copy and link two modes form mergedfb mode
|
||||
@@ -2283,12 +2161,6 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
}
|
||||
|
||||
/* Find the PCI info for this screen */
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
pXGI->PciInfo = xf86GetPciInfoForEntity(pXGI->pEnt->index);
|
||||
pXGI->PciTag = pciTag(pXGI->PciInfo->bus, pXGI->PciInfo->device,
|
||||
pXGI->PciInfo->func);
|
||||
#endif
|
||||
|
||||
pXGI->Primary = xf86IsPrimaryPci(pXGI->PciInfo);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
|
||||
"This adapter is %s display adapter\n",
|
||||
@@ -2296,11 +2168,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
|
||||
if (pXGI->Primary) {
|
||||
#if defined(__arm__)
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
VGAHWPTR(pScrn)->MapPhys = pXGI->PciInfo->regions[2].base_addr + 0xf2000000;
|
||||
#else
|
||||
VGAHWPTR(pScrn)->MapPhys = pXGI->PciInfo->ioBase[2] + 0xf2000000;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */
|
||||
@@ -2315,11 +2183,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
|
||||
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
|
||||
"VGA memory map from %p to %p \n",
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(void *)(intptr_t)pXGI->PciInfo->regions[2].base_addr, VGAHWPTR(pScrn)->Base);
|
||||
#else
|
||||
(void *)(intptr_t)pXGI->PciInfo->ioBase[2], VGAHWPTR(pScrn)->Base);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
vgaHWGetIOBase(VGAHWPTR(pScrn));
|
||||
@@ -2341,15 +2205,6 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
#endif /* !defined(__alpha__) */
|
||||
}
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
xf86SetOperatingState(resVgaMem, pXGI->pEnt->index, ResUnusedOpr);
|
||||
|
||||
/* Operations for which memory access is required */
|
||||
pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
|
||||
/* Operations for which I/O access is required */
|
||||
pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
|
||||
#endif
|
||||
|
||||
/* The ramdac module should be loaded here when needed */
|
||||
if (!xf86LoadSubModule(pScrn, "ramdac")) {
|
||||
XGIErrorLog(pScrn, "Could not load ramdac module\n");
|
||||
@@ -2567,11 +2422,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
|
||||
#else
|
||||
pXGI->RelIO = (XGIIOADDRESS) (pXGI->IODBase |
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(pXGI->PciInfo->regions[2].base_addr & 0xFFFC)
|
||||
#else
|
||||
(pXGI->PciInfo->ioBase[2] & 0xFFFC)
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -2777,21 +2628,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
XGISetup(pScrn);
|
||||
|
||||
from = X_PROBED;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pXGI->FbAddress = pXGI->PciInfo->regions[0].base_addr & 0xFFFFFFF0;
|
||||
#else
|
||||
if (pXGI->pEnt->device->MemBase != 0) {
|
||||
/*
|
||||
* XXX Should check that the config file value matches one of the
|
||||
* PCI base address values.
|
||||
*/
|
||||
pXGI->FbAddress = pXGI->pEnt->device->MemBase;
|
||||
from = X_CONFIG;
|
||||
}
|
||||
else {
|
||||
pXGI->FbAddress = pXGI->PciInfo->memBase[0] & 0xFFFFFFF0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pXGI->realFbAddress = pXGI->FbAddress;
|
||||
|
||||
@@ -2800,44 +2637,13 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
IS_DUAL_HEAD(pXGI) ? "Global l" : "L",
|
||||
(unsigned long) pXGI->FbAddress);
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pXGI->IOAddress = pXGI->PciInfo->regions[1].base_addr & 0xFFFFFFF0;
|
||||
#else
|
||||
if (pXGI->pEnt->device->IOBase != 0) {
|
||||
/*
|
||||
* XXX Should check that the config file value matches one of the
|
||||
* PCI base address values.
|
||||
*/
|
||||
pXGI->IOAddress = pXGI->pEnt->device->IOBase;
|
||||
from = X_CONFIG;
|
||||
}
|
||||
else {
|
||||
pXGI->IOAddress = pXGI->PciInfo->memBase[1] & 0xFFFFFFF0;
|
||||
}
|
||||
#endif
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, from,
|
||||
"MMIO registers at 0x%lX (size %ldK)\n",
|
||||
(unsigned long) pXGI->IOAddress, pXGI->mmioSize);
|
||||
pXGI->xgi_HwDevExt.bIntegratedMMEnabled = TRUE;
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
/* Register the PCI-assigned resources. */
|
||||
if (xf86RegisterResources(pXGI->pEnt->index, NULL, ResExclusive)) {
|
||||
XGIErrorLog(pScrn,
|
||||
"xf86RegisterResources() found resource conflicts\n");
|
||||
|
||||
if (pXGIEnt)
|
||||
pXGIEnt->ErrorAfterFirst = TRUE;
|
||||
|
||||
if (pXGI->pInt)
|
||||
xf86FreeInt10(pXGI->pInt);
|
||||
xgiRestoreExtRegisterLock(pXGI, srlockReg, crlockReg);
|
||||
XGIFreeRec(pScrn);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
from = X_PROBED;
|
||||
if (pXGI->pEnt->device->videoRam != 0) {
|
||||
|
||||
@@ -3699,7 +3505,6 @@ XGIMapMem(ScrnInfoPtr pScrn)
|
||||
{
|
||||
XGIPtr pXGI = XGIPTR(pScrn);;
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
@@ -3715,48 +3520,6 @@ XGIMapMem(ScrnInfoPtr pScrn)
|
||||
|
||||
pXGI->FbBase = pXGI->PciInfo->regions[0].memory;
|
||||
pXGI->IOBase = pXGI->PciInfo->regions[1].memory;
|
||||
#else
|
||||
int mmioFlags;
|
||||
|
||||
/*
|
||||
* Map IO registers to virtual address space
|
||||
*/
|
||||
#if !defined(__alpha__)
|
||||
mmioFlags = VIDMEM_MMIO;
|
||||
#else
|
||||
/*
|
||||
* For Alpha, we need to map SPARSE memory, since we need
|
||||
* byte/short access.
|
||||
*/
|
||||
mmioFlags = VIDMEM_MMIO | VIDMEM_SPARSE;
|
||||
#endif
|
||||
pXGI->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
|
||||
pXGI->PciTag, pXGI->IOAddress, 0x10000);
|
||||
if (pXGI->IOBase == NULL)
|
||||
return FALSE;
|
||||
|
||||
#ifdef __alpha__
|
||||
/*
|
||||
* for Alpha, we need to map DENSE memory as well, for
|
||||
* setting CPUToScreenColorExpandBase.
|
||||
*/
|
||||
pXGI->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
|
||||
pXGI->PciTag, pXGI->IOAddress, 0x10000);
|
||||
|
||||
if (pXGI->IOBaseDense == NULL)
|
||||
return FALSE;
|
||||
#endif /* __alpha__ */
|
||||
|
||||
pXGI->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
|
||||
pXGI->PciTag,
|
||||
(unsigned long) pXGI->FbAddress,
|
||||
pXGI->FbMapSize);
|
||||
|
||||
PDEBUG(ErrorF("pXGI->FbBase = 0x%08lx\n", (ULONG) (pXGI->FbBase)));
|
||||
|
||||
if (pXGI->FbBase == NULL)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3780,12 +3543,7 @@ XGIUnmapMem(ScrnInfoPtr pScrn)
|
||||
if (pXGIEnt->MapCountIOBase) {
|
||||
pXGIEnt->MapCountIOBase--;
|
||||
if ((pXGIEnt->MapCountIOBase == 0) || (pXGIEnt->forceUnmapIOBase)) {
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_region(pXGI->PciInfo, 1);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGIEnt->IOBase,
|
||||
(pXGI->mmioSize * 1024));
|
||||
#endif
|
||||
pXGIEnt->IOBase = NULL;
|
||||
pXGIEnt->MapCountIOBase = 0;
|
||||
pXGIEnt->forceUnmapIOBase = FALSE;
|
||||
@@ -3793,33 +3551,12 @@ XGIUnmapMem(ScrnInfoPtr pScrn)
|
||||
pXGI->IOBase = NULL;
|
||||
}
|
||||
#ifdef __alpha__
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#error "How to do dense mapping on Alpha?"
|
||||
#else
|
||||
if (pXGIEnt->MapCountIOBaseDense) {
|
||||
pXGIEnt->MapCountIOBaseDense--;
|
||||
if ((pXGIEnt->MapCountIOBaseDense == 0)
|
||||
|| (pXGIEnt->forceUnmapIOBaseDense)) {
|
||||
xf86UnMapVidMem(pScrn->scrnIndex,
|
||||
(pointer) pXGIEnt->IOBaseDense,
|
||||
(pXGI->mmioSize * 1024));
|
||||
pXGIEnt->IOBaseDense = NULL;
|
||||
pXGIEnt->MapCountIOBaseDense = 0;
|
||||
pXGIEnt->forceUnmapIOBaseDense = FALSE;
|
||||
}
|
||||
pXGI->IOBaseDense = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* __alpha__ */
|
||||
if (pXGIEnt->MapCountFbBase) {
|
||||
pXGIEnt->MapCountFbBase--;
|
||||
if ((pXGIEnt->MapCountFbBase == 0) || (pXGIEnt->forceUnmapFbBase)) {
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_region(pXGI->PciInfo, 0);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGIEnt->FbBase,
|
||||
pXGI->FbMapSize);
|
||||
#endif
|
||||
pXGIEnt->FbBase = NULL;
|
||||
pXGIEnt->MapCountFbBase = 0;
|
||||
pXGIEnt->forceUnmapFbBase = FALSE;
|
||||
@@ -3829,26 +3566,13 @@ XGIUnmapMem(ScrnInfoPtr pScrn)
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_region(pXGI->PciInfo, 0);
|
||||
pci_device_unmap_region(pXGI->PciInfo, 1);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGI->IOBase,
|
||||
(pXGI->mmioSize * 1024));
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGI->FbBase,
|
||||
pXGI->FbMapSize);
|
||||
#endif
|
||||
pXGI->IOBase = NULL;
|
||||
pXGI->FbBase = NULL;
|
||||
|
||||
#ifdef __alpha__
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#error "How to do dense mapping on Alpha?"
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGI->IOBaseDense,
|
||||
(pXGI->mmioSize * 1024));
|
||||
pXGI->IOBaseDense = NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5641,11 +5365,7 @@ XGI_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value)
|
||||
#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__))
|
||||
unsigned char *base;
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_map_legacy(XGIPTR(pScrn)->PciInfo, 0, 0x2000, 1, (void**)&base);
|
||||
#else
|
||||
base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
|
||||
#endif
|
||||
if (!base) {
|
||||
XGIErrorLog(pScrn, "(Could not map BIOS scratch area)\n");
|
||||
return 0;
|
||||
@@ -5657,11 +5377,6 @@ XGI_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value)
|
||||
if (value != 0xff)
|
||||
*(base + offset) = value;
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_legacy(XGIPTR(pScrn)->PciInfo, (void*)base, 0x2000);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -164,11 +164,7 @@ xgiXG2X_Setup(ScrnInfoPtr pScrn)
|
||||
|
||||
if (pXGI->Chipset == PCI_CHIP_XGIXG40) {
|
||||
const unsigned revision =
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pXGI->PciInfo->revision
|
||||
#else
|
||||
pciReadLong(pXGI->PciTag, 0x08) & 0x0FF
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Revision 2 cards encode the memory config bits slightly differently
|
||||
@@ -642,18 +638,13 @@ Bool
|
||||
bAccessVGAPCIInfo(PXGI_HW_DEVICE_INFO pHwDevInfo, ULONG ulOffset, ULONG ulSet, CARD32 *pulValue)
|
||||
{
|
||||
XGIPtr pXGI ;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
int err;
|
||||
#else
|
||||
PCITAG pciDev;
|
||||
#endif
|
||||
|
||||
if (!pHwDevInfo || !pulValue) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pXGI = (XGIPtr)pHwDevInfo->pDevice ;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
if (ulSet) {
|
||||
err = pci_device_cfg_write_u32(pXGI->PciInfo, *pulValue,
|
||||
ulOffset & ~3);
|
||||
@@ -663,15 +654,4 @@ bAccessVGAPCIInfo(PXGI_HW_DEVICE_INFO pHwDevInfo, ULONG ulOffset, ULONG ulSet, C
|
||||
}
|
||||
|
||||
return (err == 0);
|
||||
#else
|
||||
pciDev = pXGI->PciTag ;
|
||||
|
||||
if (ulSet) {
|
||||
pciWriteLong(pciDev, ulOffset&0xFFFFFFFc, *pulValue);
|
||||
} else {
|
||||
*pulValue = pciReadLong(pciDev, ulOffset&0xFFFFFFFc);
|
||||
}
|
||||
|
||||
return TRUE ;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user