mirror of
https://github.com/X11Libre/xf86-video-xgi.git
synced 2026-03-24 01:24:35 +00:00
Port to libpciaccess and related interfaces.
This commit is contained in:
@@ -96,6 +96,15 @@ if test "x$DRI" = xyes; then
|
||||
AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
|
||||
fi
|
||||
|
||||
AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
|
||||
[XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
|
||||
[#include "xorg-server.h"])
|
||||
|
||||
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)
|
||||
|
||||
AC_SUBST([DRI_CFLAGS])
|
||||
AC_SUBST([XORG_CFLAGS])
|
||||
AC_SUBST([moduledir])
|
||||
|
||||
@@ -217,10 +217,6 @@ struct _XGI_HW_DEVICE_INFO
|
||||
{
|
||||
ULONG ulExternalChip; /* NO VB or other video bridge*/
|
||||
/* if ujVBChipID = VB_CHIP_UNKNOWN, */
|
||||
#ifdef LINUX_XF86
|
||||
PCITAG PciTag; /* PCI Tag */
|
||||
#endif
|
||||
|
||||
PUCHAR pjVirtualRomBase; /* ROM image */
|
||||
|
||||
BOOLEAN UseROM; /* Use the ROM image if provided */
|
||||
@@ -281,8 +277,6 @@ struct _XGI_HW_DEVICE_INFO
|
||||
|
||||
PXGI_QUERYSPACE pQueryVGAConfigSpace;
|
||||
|
||||
PXGI_QUERYSPACE pQueryNorthBridgeSpace;
|
||||
|
||||
UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH];
|
||||
|
||||
};
|
||||
|
||||
20
src/xgi.h
20
src/xgi.h
@@ -96,7 +96,11 @@
|
||||
|
||||
#undef XGI_CP
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#include <pciaccess.h>
|
||||
#else
|
||||
#include "xf86Pci.h"
|
||||
#endif
|
||||
#include "xf86Cursor.h"
|
||||
#include "xf86xv.h"
|
||||
#include "compiler.h"
|
||||
@@ -128,6 +132,18 @@
|
||||
#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
|
||||
|
||||
#if 1
|
||||
#define XGIDUALHEAD /* Include Dual Head code */
|
||||
#endif
|
||||
@@ -496,8 +512,12 @@ 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;
|
||||
|
||||
@@ -485,9 +485,17 @@ 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);
|
||||
((pciConfigPtr)pXGI->PciInfo->thisCard)->funcnum
|
||||
#endif
|
||||
);
|
||||
|
||||
if((drmCtlInstHandler(pXGI->drmSubFD, pXGI->irq)) != 0)
|
||||
{
|
||||
@@ -653,11 +661,10 @@ XGIDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
|
||||
Volari_Idle(pXGI);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
|
||||
* Use this function to check AGP slot
|
||||
* Jill, 2006/6/24
|
||||
*******************************************************************************/
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
/**
|
||||
* Use this function to check AGP slot
|
||||
*/
|
||||
ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
|
||||
{
|
||||
ULONG uBuffer = 0, uLink = 0, uValue = 0 ;
|
||||
@@ -680,17 +687,23 @@ ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
|
||||
|
||||
return uValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* IsXGIAGPCard(ScreenPtr pScreen)
|
||||
* Use this function to check if the current card is agp or pci card
|
||||
* Jill, 2006/6/24
|
||||
*******************************************************************************/
|
||||
ULONG IsXGIAGPCard(ScreenPtr pScreen)
|
||||
/**
|
||||
* Use this function to check if the current card is AGP or PCI.
|
||||
*/
|
||||
ULONG IsXGIAGPCard(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
XGIPtr pXGI = XGIPTR(pScrn);
|
||||
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
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);
|
||||
|
||||
@@ -717,4 +730,5 @@ ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[%s] This Card Type is PCIExpress\n", __FUNCTION__);
|
||||
|
||||
return uType;
|
||||
#endif
|
||||
}
|
||||
|
||||
181
src/xgi_driver.c
181
src/xgi_driver.c
@@ -99,6 +99,13 @@
|
||||
#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) */
|
||||
|
||||
@@ -136,6 +143,18 @@ 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) }
|
||||
|
||||
static const struct pci_id_match xgi_device_match[] = {
|
||||
XGI_DEVICE_MATCH(PCI_CHIP_XGIXG40, 0),
|
||||
XGI_DEVICE_MATCH(PCI_CHIP_XGIXG20, 1),
|
||||
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This contains the functions needed by the server after loading the driver
|
||||
* module. It must be supplied, and gets passed back by the SetupProc
|
||||
@@ -148,10 +167,20 @@ DriverRec XGI = {
|
||||
XGI_CURRENT_VERSION,
|
||||
XGI_DRIVER_NAME,
|
||||
XGIIdentify,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
NULL,
|
||||
#else
|
||||
XGIProbe,
|
||||
#endif
|
||||
XGIAvailableOptions,
|
||||
NULL,
|
||||
0
|
||||
0,
|
||||
NULL,
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
xgi_device_match,
|
||||
XGIPciProbe
|
||||
#endif
|
||||
};
|
||||
|
||||
static SymTabRec XGIChipsets[] = {
|
||||
@@ -419,7 +448,7 @@ xgiSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||
|
||||
if (!setupDone) {
|
||||
setupDone = TRUE;
|
||||
xf86AddDriver(&XGI, module, 0);
|
||||
xf86AddDriver(&XGI, module, HaveDriverFuncs);
|
||||
LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols,
|
||||
shadowSymbols, ramdacSymbols, ddcSymbols,
|
||||
vbeSymbols, int10Symbols,
|
||||
@@ -676,6 +705,46 @@ XGIErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
|
||||
}
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static Bool XGIPciProbe(DriverPtr drv, int entity_num,
|
||||
struct pci_device *dev, intptr_t match_data)
|
||||
{
|
||||
ScrnInfoPtr pScrn;
|
||||
|
||||
|
||||
pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
if (pScrn != NULL) {
|
||||
XGIPtr pXGI;
|
||||
|
||||
/* Fill in what we can of the ScrnInfoRec */
|
||||
pScrn->driverVersion = XGI_CURRENT_VERSION;
|
||||
pScrn->driverName = XGI_DRIVER_NAME;
|
||||
pScrn->name = XGI_NAME;
|
||||
pScrn->Probe = NULL;
|
||||
pScrn->PreInit = XGIPreInit;
|
||||
pScrn->ScreenInit = XGIScreenInit;
|
||||
pScrn->SwitchMode = XGISwitchMode;
|
||||
pScrn->AdjustFrame = XGIAdjustFrame;
|
||||
pScrn->EnterVT = XGIEnterVT;
|
||||
pScrn->LeaveVT = XGILeaveVT;
|
||||
pScrn->FreeScreen = XGIFreeScreen;
|
||||
pScrn->ValidMode = XGIValidMode;
|
||||
|
||||
|
||||
pXGI = XGIGetRec(pScrn);
|
||||
if (pXGI == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pXGI->PciInfo = dev;
|
||||
}
|
||||
|
||||
return (pScrn != NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Mandatory */
|
||||
static Bool
|
||||
XGIProbe(DriverPtr drv, int flags)
|
||||
@@ -784,6 +853,7 @@ XGIProbe(DriverPtr drv, int flags)
|
||||
|
||||
return foundScreen;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Some helper functions for MergedFB mode */
|
||||
@@ -2265,11 +2335,11 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
#endif
|
||||
|
||||
/* Find the PCI info for this screen */
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
pXGI->PciInfo = xf86GetPciInfoForEntity(pXGI->pEnt->index);
|
||||
pXGI->PciTag =
|
||||
pXGI->xgi_HwDevExt.PciTag =
|
||||
pciTag(pXGI->PciInfo->bus,
|
||||
pXGI->PciInfo->device, pXGI->PciInfo->func);
|
||||
pXGI->PciTag = pciTag(pXGI->PciInfo->bus, pXGI->PciInfo->device,
|
||||
pXGI->PciInfo->func);
|
||||
#endif
|
||||
|
||||
pXGI->Primary = xf86IsPrimaryPci(pXGI->PciInfo);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
|
||||
@@ -2289,8 +2359,13 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
/* We "patch" the PIOOffset inside vgaHW in order to force
|
||||
* the vgaHW module to use our relocated i/o ports.
|
||||
*/
|
||||
VGAHWPTR(pScrn)->PIOOffset =
|
||||
pXGI->IODBase + (pXGI->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
|
||||
VGAHWPTR(pScrn)->PIOOffset = pXGI->IODBase - 0x380 +
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(pXGI->PciInfo->regions[2].base_addr & 0xFFFC)
|
||||
#else
|
||||
(pXGI->PciInfo->ioBase[2] & 0xFFFC)
|
||||
#endif
|
||||
;
|
||||
|
||||
pXGI->pInt = NULL;
|
||||
if (!pXGI->Primary) {
|
||||
@@ -2358,7 +2433,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
else {
|
||||
PDEBUG(ErrorF(" --- Chipset 3 \n"));
|
||||
from = X_PROBED;
|
||||
pXGI->Chipset = pXGI->PciInfo->chipType;
|
||||
pXGI->Chipset = DEVICE_ID(pXGI->PciInfo);
|
||||
pScrn->chipset =
|
||||
(char *) xf86TokenToString(XGIChipsets, pXGI->Chipset);
|
||||
}
|
||||
@@ -2368,7 +2443,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pXGI->ChipRev);
|
||||
}
|
||||
else {
|
||||
pXGI->ChipRev = pXGI->PciInfo->chipRev;
|
||||
pXGI->ChipRev = CHIP_REVISION(pXGI->PciInfo);
|
||||
}
|
||||
pXGI->xgi_HwDevExt.jChipRevision = pXGI->ChipRev;
|
||||
|
||||
@@ -2521,8 +2596,13 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
}
|
||||
|
||||
/* Get our relocated IO registers */
|
||||
pXGI->RelIO =
|
||||
(XGIIOADDRESS) ((pXGI->PciInfo->ioBase[2] & 0xFFFC) + pXGI->IODBase);
|
||||
pXGI->RelIO = (XGIIOADDRESS) (pXGI->IODBase |
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(pXGI->PciInfo->regions[2].base_addr & 0xFFFC)
|
||||
#else
|
||||
(pXGI->PciInfo->ioBase[2] & 0xFFFC)
|
||||
#endif
|
||||
);
|
||||
pXGI->xgi_HwDevExt.pjIOAddress = (XGIIOADDRESS) (pXGI->RelIO + 0x30);
|
||||
xf86DrvMsg(pScrn->scrnIndex, from, "Relocated IO registers at 0x%lX\n",
|
||||
(unsigned long) pXGI->RelIO);
|
||||
@@ -2726,6 +2806,9 @@ 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
|
||||
@@ -2737,6 +2820,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
else {
|
||||
pXGI->FbAddress = pXGI->PciInfo->memBase[0] & 0xFFFFFFF0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pXGI->realFbAddress = pXGI->FbAddress;
|
||||
|
||||
@@ -2745,6 +2829,9 @@ 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
|
||||
@@ -2756,6 +2843,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
else {
|
||||
pXGI->IOAddress = pXGI->PciInfo->memBase[1] & 0xFFFFFFF0;
|
||||
}
|
||||
#endif
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, from,
|
||||
"MMIO registers at 0x%lX (size %ldK)\n",
|
||||
@@ -3627,10 +3715,26 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
static Bool
|
||||
XGIMapMem(ScrnInfoPtr pScrn)
|
||||
{
|
||||
XGIPtr pXGI;
|
||||
int mmioFlags;
|
||||
XGIPtr pXGI = XGIPTR(pScrn);;
|
||||
|
||||
pXGI = XGIPTR(pScrn);
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
int err;
|
||||
|
||||
err = pci_device_map_region(pXGI->PciInfo, i, TRUE);
|
||||
if (err) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Internal error: cound not map PCI region %u\n", i);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
pXGI->FbBase = pXGI->PciInfo->regions[0].memory;
|
||||
pXGI->IOBase = pXGI->PciInfo->regions[1].memory;
|
||||
#else
|
||||
int mmioFlags;
|
||||
|
||||
/*
|
||||
* Map IO registers to virtual address space
|
||||
@@ -3670,6 +3774,7 @@ XGIMapMem(ScrnInfoPtr pScrn)
|
||||
|
||||
if (pXGI->FbBase == NULL)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3693,8 +3798,12 @@ 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;
|
||||
@@ -3702,6 +3811,9 @@ 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)
|
||||
@@ -3715,12 +3827,17 @@ XGIUnmapMem(ScrnInfoPtr pScrn)
|
||||
}
|
||||
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;
|
||||
@@ -3730,17 +3847,27 @@ 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
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pXGI->FbBase,
|
||||
pXGI->FbMapSize);
|
||||
pXGI->FbBase = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -3844,8 +3971,13 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
}
|
||||
|
||||
/* Reset our PIOOffset as vgaHWInit might have reset it */
|
||||
VGAHWPTR(pScrn)->PIOOffset =
|
||||
pXGI->IODBase + (pXGI->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
|
||||
VGAHWPTR(pScrn)->PIOOffset = pXGI->IODBase - 0x380 +
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(pXGI->PciInfo->regions[2].base_addr & 0xFFFC)
|
||||
#else
|
||||
(pXGI->PciInfo->ioBase[2] & 0xFFFC)
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Prepare the register contents */
|
||||
if (!(*pXGI->ModeInit) (pScrn, mode)) {
|
||||
@@ -4034,8 +4166,13 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
||||
/* Patch the PIOOffset inside vgaHW to use
|
||||
* our relocated IO ports.
|
||||
*/
|
||||
VGAHWPTR(pScrn)->PIOOffset =
|
||||
pXGI->IODBase + (pXGI->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
|
||||
VGAHWPTR(pScrn)->PIOOffset = pXGI->IODBase - 0x380 +
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
(pXGI->PciInfo->regions[2].base_addr & 0xFFFC)
|
||||
#else
|
||||
(pXGI->PciInfo->ioBase[2] & 0xFFFC)
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Map the XGI memory and MMIO areas */
|
||||
if (!XGIMapMem(pScrn)) {
|
||||
|
||||
@@ -690,7 +690,6 @@ static const unsigned char XGI301CScaling[] = {
|
||||
|
||||
/* Mandatory functions */
|
||||
static void XGIIdentify(int flags);
|
||||
static Bool XGIProbe(DriverPtr drv, int flags);
|
||||
static Bool XGIPreInit(ScrnInfoPtr pScrn, int flags);
|
||||
static Bool XGIScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
|
||||
static Bool XGIEnterVT(int scrnIndex, int flags);
|
||||
|
||||
@@ -164,7 +164,7 @@ xgiXG40_Setup(ScrnInfoPtr pScrn)
|
||||
* chips encode the DRAM channel count differently than other
|
||||
* revisions.
|
||||
*/
|
||||
if ((pciReadLong(pXGI->PciTag, 0x08) & 0xFF) == 2) {
|
||||
if (pXGI->ChipRev == 2) {
|
||||
switch ((ulMemConfig >> 2) & 0x1) {
|
||||
case 1:
|
||||
/* Dual channel */
|
||||
@@ -306,15 +306,9 @@ XGI_IsXG21(ScrnInfoPtr pScrn)
|
||||
void
|
||||
XGI_InitHwDevInfo(ScrnInfoPtr pScrn)
|
||||
{
|
||||
XGIPtr pXGI ;
|
||||
PXGI_HW_DEVICE_INFO pHwDevInfo ;
|
||||
PCITAG NBridge ;
|
||||
ULONG ulTemp ;
|
||||
int i ;
|
||||
|
||||
pXGI = XGIPTR(pScrn ) ;
|
||||
pHwDevInfo = &pXGI->xgi_HwDevExt ;
|
||||
NBridge = pciTag(0,0,0) ;
|
||||
XGIPtr pXGI = XGIPTR(pScrn);
|
||||
PXGI_HW_DEVICE_INFO pHwDevInfo = &pXGI->xgi_HwDevExt;
|
||||
int i;
|
||||
|
||||
pHwDevInfo->pDevice = pXGI ;
|
||||
pHwDevInfo->pjVirtualRomBase = pXGI->BIOS ;
|
||||
@@ -323,12 +317,9 @@ XGI_InitHwDevInfo(ScrnInfoPtr pScrn)
|
||||
PDEBUG(ErrorF("pXGI->FbBase = 0x%08lx\n",(ULONG)(pXGI->FbBase))) ;
|
||||
PDEBUG(ErrorF("pHwDevInfo->pjVideoMemoryAddress = 0x%08lx\n",(ULONG)(pHwDevInfo->pjVideoMemoryAddress))) ;
|
||||
pHwDevInfo->ulVideoMemorySize = pXGI->FbMapSize ;
|
||||
/* pHwDevInfo->pjIOAddress = (PUCHAR)((ULONG)(pXGI->RelIO) + 0x30) ; */
|
||||
pHwDevInfo->pjIOAddress = pXGI->RelIO + 0x30 ;
|
||||
pHwDevInfo->jChipType = XGI_VGALegacy ;
|
||||
|
||||
|
||||
switch( pXGI->Chipset ){
|
||||
switch (pXGI->Chipset) {
|
||||
case PCI_CHIP_XGIXG40:
|
||||
pHwDevInfo->jChipType = XG40 ;
|
||||
break ;
|
||||
@@ -340,8 +331,7 @@ XGI_InitHwDevInfo(ScrnInfoPtr pScrn)
|
||||
break ;
|
||||
}
|
||||
|
||||
ulTemp = pciReadLong(pXGI->PciTag, 0x08) ;
|
||||
pHwDevInfo->jChipRevision = (UCHAR)(ulTemp & 0xff) ;
|
||||
pHwDevInfo->jChipRevision = pXGI->ChipRev;
|
||||
pHwDevInfo->ujVBChipID = VB_CHIP_UNKNOWN ;
|
||||
pHwDevInfo->ulExternalChip = 0 ;
|
||||
|
||||
@@ -352,7 +342,6 @@ XGI_InitHwDevInfo(ScrnInfoPtr pScrn)
|
||||
pHwDevInfo->pSR = pXGI->SRList ;
|
||||
pHwDevInfo->pCR = pXGI->CRList ;
|
||||
pHwDevInfo->pQueryVGAConfigSpace = (PXGI_QUERYSPACE) bAccessVGAPCIInfo;
|
||||
pHwDevInfo->pQueryNorthBridgeSpace = (PXGI_QUERYSPACE) bAccessNBridgePCIInfo;
|
||||
|
||||
for( i = 0 ; i < ExtRegSize ; i++ ){
|
||||
pHwDevInfo->pSR[i].jIdx = 0xFF ;
|
||||
@@ -397,47 +386,36 @@ Bool
|
||||
bAccessVGAPCIInfo(PXGI_HW_DEVICE_INFO pHwDevInfo, ULONG ulOffset, ULONG ulSet, ULONG *pulValue)
|
||||
{
|
||||
XGIPtr pXGI ;
|
||||
PCITAG pciDev ;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
int err;
|
||||
#else
|
||||
PCITAG pciDev;
|
||||
#endif
|
||||
|
||||
if( (!pHwDevInfo) || (!pulValue) )
|
||||
{
|
||||
return FALSE ;
|
||||
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);
|
||||
} else {
|
||||
err = pci_device_cfg_write_u32(pXGI->PciInfo, pulValue,
|
||||
ulOffset & ~3);
|
||||
}
|
||||
|
||||
return (err == 0);
|
||||
#else
|
||||
pciDev = pXGI->PciTag ;
|
||||
|
||||
if( ulSet )
|
||||
{
|
||||
pciWriteLong(pciDev, ulOffset&0xFFFFFFFc, *pulValue ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pulValue = pciReadLong(pciDev, ulOffset&0xFFFFFFFc ) ;
|
||||
}
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
bAccessNBridgePCIInfo(PXGI_HW_DEVICE_INFO pHwDevInfo, ULONG ulOffset, ULONG ulSet, ULONG *pulValue)
|
||||
{
|
||||
PCITAG pciDev = pciTag(0,0,0);
|
||||
|
||||
if( (!pulValue) )
|
||||
{
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
if( ulSet )
|
||||
{
|
||||
pciWriteLong(pciDev, ulOffset&0xFFFFFFFc, *pulValue ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pulValue = pciReadLong(pciDev, ulOffset&0xFFFFFFFc ) ;
|
||||
if (ulSet) {
|
||||
pciWriteLong(pciDev, ulOffset&0xFFFFFFFc, *pulValue);
|
||||
} else {
|
||||
*pulValue = pciReadLong(pciDev, ulOffset&0xFFFFFFFc);
|
||||
}
|
||||
|
||||
return TRUE ;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user