mirror of
https://github.com/X11Libre/xf86-video-geode.git
synced 2026-03-24 01:24:52 +00:00
drop support for ancient pre-pciaccess xservers
The Xserver's PCI handling as long moved to libpciaccess decades ago. Cleanup up those code pathes which were only meant for really ancient xserver versions that we really don't support anymore. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
15
configure.ac
15
configure.ac
@@ -136,20 +136,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
|
||||
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
|
||||
|
||||
# Obtain compiler/linker options for the Geode driver dependencies
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto fontsproto xextproto >= 7.0.99.1 $REQUIRED_MODULES])
|
||||
|
||||
# Checks for libpciaccess support.
|
||||
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
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto fontsproto xextproto >= 7.0.99.1 pciaccess >= 0.8.0 $REQUIRED_MODULES])
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
#include "compiler.h"
|
||||
#include "geode.h"
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#include <pciaccess.h>
|
||||
#endif
|
||||
|
||||
/* GPIO Register defines from the CS5536 datasheet */
|
||||
|
||||
@@ -61,7 +59,6 @@
|
||||
static unsigned short
|
||||
geode_gpio_iobase(void)
|
||||
{
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
struct pci_device *pci;
|
||||
|
||||
/* The CS5536 GPIO device is always in the same slot: 00:0f.0 */
|
||||
@@ -77,21 +74,6 @@ geode_gpio_iobase(void)
|
||||
|
||||
/* The GPIO I/O address is in resource 1 */
|
||||
return (unsigned short) pci->regions[1].base_addr;
|
||||
#else
|
||||
PCITAG Tag;
|
||||
|
||||
Tag = pciFindFirst(CS5536_ISA_DEVICE, 0xFFFFFFFF);
|
||||
|
||||
if (Tag == PCI_NOT_FOUND) {
|
||||
Tag = pciFindFirst(CS5535_ISA_DEVICE, 0xFFFFFFFF);
|
||||
|
||||
if (Tag == PCI_NOT_FOUND)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The GPIO I/O address is in resource 1 */
|
||||
return (unsigned short) (pciReadLong(Tag, 0x14) & ~1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -76,13 +76,8 @@
|
||||
static const OptionInfoRec *AmdAvailableOptions(int chipid, int busid);
|
||||
static void AmdIdentify(int);
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static Bool AmdPciProbe(DriverPtr, int, struct pci_device *, intptr_t);
|
||||
#else
|
||||
static Bool AmdProbe(DriverPtr, int);
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static const struct pci_id_match amdDeviceMatch[] = {
|
||||
{PCI_VENDOR_ID_NS, PCI_CHIP_GEODEGX, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0,
|
||||
0},
|
||||
@@ -90,7 +85,6 @@ static const struct pci_id_match amdDeviceMatch[] = {
|
||||
0},
|
||||
{0, 0, 0}
|
||||
};
|
||||
#endif /* XSERVER_LIBPCIACCESS */
|
||||
|
||||
/* driver record contains the functions needed by the server after loading
|
||||
* the driver module.
|
||||
@@ -99,38 +93,26 @@ _X_EXPORT DriverRec AMD = {
|
||||
GEODE_VERSION,
|
||||
"amd",
|
||||
AmdIdentify,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
NULL,
|
||||
#else
|
||||
AmdProbe,
|
||||
#endif
|
||||
AmdAvailableOptions,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
amdDeviceMatch,
|
||||
AmdPciProbe
|
||||
#endif
|
||||
};
|
||||
|
||||
_X_EXPORT DriverRec GEODE = {
|
||||
GEODE_VERSION,
|
||||
"geode",
|
||||
AmdIdentify,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
NULL,
|
||||
#else
|
||||
AmdProbe,
|
||||
#endif
|
||||
AmdAvailableOptions,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
amdDeviceMatch,
|
||||
AmdPciProbe
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Advanced Micro Devices Chip Models */
|
||||
@@ -253,9 +235,7 @@ GeodeSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
|
||||
static Bool init = FALSE;
|
||||
int flag = 0;
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
flag = HaveDriverFuncs;
|
||||
#endif
|
||||
if (init) {
|
||||
*ErrorMajor = LDR_ONCEONLY;
|
||||
return (pointer) NULL;
|
||||
@@ -275,11 +255,7 @@ AmdSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
|
||||
if (!Initialised) {
|
||||
Initialised = TRUE;
|
||||
xf86AddDriver(&AMD, Module,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
HaveDriverFuncs
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
|
||||
return (pointer) TRUE;
|
||||
@@ -350,8 +326,6 @@ AmdAvailableOptions(int chipid, int busid)
|
||||
return no_GeodeOptions;
|
||||
}
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
|
||||
static Bool
|
||||
AmdPciProbe(DriverPtr driver,
|
||||
int entity_num, struct pci_device *device, intptr_t match_data)
|
||||
@@ -387,127 +361,3 @@ AmdPciProbe(DriverPtr driver,
|
||||
}
|
||||
return scrn != NULL;
|
||||
}
|
||||
|
||||
#else /* XSERVER_LIBPCIACCESS */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* AmdProbe.
|
||||
*
|
||||
* Description :This is to find that hardware is claimed by another
|
||||
* driver if not claim the slot & allocate ScreenInfoRec.
|
||||
*
|
||||
* Parameters.
|
||||
* drv :a pointer to the geode driver
|
||||
* flags :flags may passed to check the config and probe detect
|
||||
*
|
||||
* Returns :TRUE on success and FALSE on failure.
|
||||
*
|
||||
* Comments :This should be minimal probe and it should under no
|
||||
* circumstances change the state of the hardware.Don't do
|
||||
* any initializations other than the required
|
||||
* ScreenInforec.
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Bool
|
||||
AmdProbe(DriverPtr drv, int flags)
|
||||
{
|
||||
Bool foundScreen = FALSE;
|
||||
int numDevSections, numUsed;
|
||||
GDevPtr *devSections = NULL;
|
||||
int *usedChips = NULL;
|
||||
int i;
|
||||
void (*drvr_setup)(ScrnInfoPtr pScrni) = NULL;
|
||||
int CPUDetected;
|
||||
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: Probing for supported devices!\n"));
|
||||
/*
|
||||
* * Find the config file Device sections that match this
|
||||
* * driver, and return if there are none.
|
||||
*/
|
||||
if ((numDevSections = xf86MatchDevice(GEODE_NAME, &devSections)) <= 0) {
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: failed 1!\n"));
|
||||
return FALSE;
|
||||
}
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: Before MatchPciInstances!\n"));
|
||||
/* PCI BUS */
|
||||
if (xf86GetPciVideoInfo()) {
|
||||
numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_NS,
|
||||
GeodeChipsets, GeodePCIchipsets,
|
||||
devSections, numDevSections, drv,
|
||||
&usedChips);
|
||||
|
||||
if (numUsed <= 0)
|
||||
numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_AMD,
|
||||
GeodeChipsets, GeodePCIchipsets,
|
||||
devSections, numDevSections, drv,
|
||||
&usedChips);
|
||||
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: MatchPCI (%d)!\n", numUsed));
|
||||
|
||||
if (numUsed > 0) {
|
||||
if (flags & PROBE_DETECT)
|
||||
foundScreen = TRUE;
|
||||
else {
|
||||
/* Durango only supports one instance, */
|
||||
/* so take the first one */
|
||||
for (i = 0; i < numUsed; i++) {
|
||||
/* Allocate a ScrnInfoRec */
|
||||
ScrnInfoPtr pScrni = NULL;
|
||||
EntityInfoPtr pEnt = xf86GetEntityInfo(usedChips[i]);
|
||||
PciChipsets *p_id;
|
||||
|
||||
pScrni = xf86ConfigPciEntity(pScrni, 0, usedChips[i],
|
||||
GeodePCIchipsets, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
for (p_id = GeodePCIchipsets; p_id->numChipset != -1;
|
||||
p_id++) {
|
||||
if (pEnt->chipset == p_id->numChipset) {
|
||||
switch (pEnt->chipset) {
|
||||
#ifdef HAVE_LX
|
||||
case PCI_CHIP_GEODELX:
|
||||
CPUDetected = LX;
|
||||
drvr_setup = &LXSetupChipsetFPtr;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_GX
|
||||
case PCI_CHIP_GEODEGX:
|
||||
CPUDetected = GX;
|
||||
drvr_setup = &GXSetupChipsetFPtr;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(pEnt);
|
||||
if (drvr_setup == NULL)
|
||||
return FALSE;
|
||||
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: CPUDetected %d!\n",
|
||||
CPUDetected));
|
||||
|
||||
pScrni->driverName = GEODE_DRIVER_NAME;
|
||||
pScrni->driverVersion = GEODE_VERSION;
|
||||
pScrni->name = GEODE_NAME;
|
||||
pScrni->Probe = AmdProbe;
|
||||
drvr_setup(pScrni);
|
||||
|
||||
foundScreen = TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usedChips)
|
||||
free(usedChips);
|
||||
if (devSections)
|
||||
free(devSections);
|
||||
DEBUGMSG(1, (0, X_INFO, "AmdProbe: result (%d)!\n", foundScreen));
|
||||
return foundScreen;
|
||||
}
|
||||
|
||||
#endif /* else XSERVER_LIBPCIACCESS */
|
||||
|
||||
@@ -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 /* CIRPCIRENAME_H */
|
||||
|
||||
@@ -217,7 +217,6 @@ GXSaveScreen(ScreenPtr pScrn, int mode)
|
||||
}
|
||||
|
||||
/* Common function - used by the LX too */
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static inline void *
|
||||
map_pci_mem(ScrnInfoPtr pScrni, int vram,
|
||||
struct pci_device *dev, int bar, int size)
|
||||
@@ -242,7 +241,6 @@ unmap_pci_mem(ScrnInfoPtr pScrni, struct pci_device *dev, void *ptr, int size)
|
||||
{
|
||||
return pci_device_unmap_range(dev, ptr, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern unsigned long gfx_gx2_scratch_base;
|
||||
|
||||
@@ -254,34 +252,13 @@ GXMapMem(ScrnInfoPtr pScrni)
|
||||
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
gfx_virt_regptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
|
||||
pci->memBase[2],
|
||||
pci->size[2]);
|
||||
|
||||
gfx_virt_gpptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
|
||||
pci->memBase[1],
|
||||
pci->size[1]);
|
||||
|
||||
gfx_virt_vidptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
|
||||
pci->memBase[3],
|
||||
pci->size[3]);
|
||||
|
||||
gfx_virt_fbptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_FRAMEBUFFER,
|
||||
pci->memBase[0],
|
||||
pGeode->FBAvail);
|
||||
#else
|
||||
gfx_virt_regptr = map_pci_mem(pScrni, 0, pci, 2, 0);
|
||||
gfx_virt_gpptr = map_pci_mem(pScrni, 0, pci, 1, 0);
|
||||
gfx_virt_vidptr = map_pci_mem(pScrni, 0, pci, 3, 0);
|
||||
gfx_virt_fbptr = map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail);
|
||||
#endif
|
||||
|
||||
gfx_gx2_scratch_base = pGeode->FBAvail - 0x4000;
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000);
|
||||
#else
|
||||
{
|
||||
int fd = open("/dev/mem", O_RDWR);
|
||||
|
||||
@@ -294,7 +271,6 @@ GXMapMem(ScrnInfoPtr pScrni)
|
||||
0xF0000);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
pGeode->FBBase = gfx_virt_fbptr;
|
||||
|
||||
if ((!gfx_virt_regptr) || (!gfx_virt_gpptr) ||
|
||||
@@ -317,27 +293,9 @@ GXMapMem(ScrnInfoPtr pScrni)
|
||||
static Bool
|
||||
GXCheckVGA(ScrnInfoPtr pScrni, EntityInfoPtr pEnt)
|
||||
{
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
unsigned char *ptr;
|
||||
const char *vgasig = "IBM VGA Compatible";
|
||||
int ret;
|
||||
|
||||
ptr =
|
||||
xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E,
|
||||
strlen(vgasig));
|
||||
|
||||
if (ptr == NULL)
|
||||
return FALSE;
|
||||
|
||||
ret = memcmp(ptr, vgasig, strlen(vgasig));
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig));
|
||||
|
||||
return ret ? FALSE : TRUE;
|
||||
#else
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pEnt->index);
|
||||
|
||||
return pci_device_is_boot_vga(pci);
|
||||
#endif
|
||||
}
|
||||
|
||||
static Bool
|
||||
@@ -358,10 +316,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
|
||||
return FALSE;
|
||||
|
||||
pEnt = xf86GetEntityInfo(pScrni->entityList[0]);
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
if (pEnt->resources)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
pGeode = pScrni->driverPrivate = XNFcallocarray(1, sizeof(GeodeRec));
|
||||
|
||||
@@ -637,13 +591,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) {
|
||||
xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
|
||||
"Couldn't register the resources.\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -667,12 +614,6 @@ GXUnmapMem(ScrnInfoPtr pScrni)
|
||||
GeodeRec *pGeode = GEODEPTR(pScrni);
|
||||
|
||||
/* unmap all the memory map's */
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_regptr, GX_CPU_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_gpptr, GX_GP_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_vidptr, GX_VID_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_fbptr, pGeode->FBAvail);
|
||||
#else
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
|
||||
|
||||
unmap_pci_mem(pScrni, pci, gfx_virt_regptr, GX_CPU_REG_SIZE);
|
||||
@@ -681,7 +622,6 @@ GXUnmapMem(ScrnInfoPtr pScrni)
|
||||
unmap_pci_mem(pScrni, pci, gfx_virt_fbptr, pGeode->FBAvail);
|
||||
|
||||
munmap(XpressROMPtr, 0x10000);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,6 @@ LXCalcPitch(ScrnInfoPtr pScrni)
|
||||
return ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3);
|
||||
}
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static inline void *
|
||||
map_pci_mem(ScrnInfoPtr pScrni, int vram,
|
||||
struct pci_device *dev, int bar, int size)
|
||||
@@ -201,8 +200,6 @@ unmap_pci_mem(ScrnInfoPtr pScrni, struct pci_device *dev, void *ptr, int size)
|
||||
return pci_device_unmap_range(dev, ptr, size);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
LXMapMem(ScrnInfoPtr pScrni)
|
||||
{
|
||||
@@ -212,39 +209,12 @@ LXMapMem(ScrnInfoPtr pScrni)
|
||||
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
PCITAG tag;
|
||||
|
||||
tag = pciTag(pci->bus, pci->device, pci->func);
|
||||
|
||||
cim_gp_ptr = (unsigned char *) xf86MapPciMem(index, VIDMEM_MMIO,
|
||||
tag, pci->memBase[1],
|
||||
LX_GP_REG_SIZE);
|
||||
|
||||
cim_vg_ptr = (unsigned char *) xf86MapPciMem(index, VIDMEM_MMIO,
|
||||
tag, pci->memBase[2],
|
||||
LX_VG_REG_SIZE);
|
||||
|
||||
cim_vid_ptr = (unsigned char *) xf86MapPciMem(index, VIDMEM_MMIO,
|
||||
tag, pci->memBase[3],
|
||||
LX_VID_REG_SIZE);
|
||||
|
||||
cim_vip_ptr = (unsigned char *) xf86MapPciMem(index, VIDMEM_MMIO,
|
||||
tag, pci->memBase[4],
|
||||
LX_VIP_REG_SIZE);
|
||||
|
||||
cim_fb_ptr = (unsigned char *) xf86MapPciMem(index, VIDMEM_FRAMEBUFFER,
|
||||
tag, pci->memBase[0],
|
||||
pGeode->FBAvail +
|
||||
CIM_CMD_BFR_SZ);
|
||||
#else
|
||||
cim_gp_ptr = map_pci_mem(pScrni, 0, pci, 1, LX_GP_REG_SIZE);
|
||||
cim_vg_ptr = map_pci_mem(pScrni, 0, pci, 2, LX_VG_REG_SIZE);
|
||||
cim_vid_ptr = map_pci_mem(pScrni, 0, pci, 3, LX_VID_REG_SIZE);
|
||||
cim_vip_ptr = map_pci_mem(pScrni, 0, pci, 4, LX_VIP_REG_SIZE);
|
||||
cim_fb_ptr =
|
||||
map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail + CIM_CMD_BFR_SZ);
|
||||
#endif
|
||||
|
||||
if (pScrni->memPhysBase == 0)
|
||||
pScrni->memPhysBase = PCI_REGION_BASE(pci, 0, REGION_MEM);
|
||||
@@ -260,9 +230,6 @@ LXMapMem(ScrnInfoPtr pScrni)
|
||||
pGeode->FBAvail);
|
||||
gp_set_command_buffer_base(cmd_bfr_phys, 0, pGeode->CmdBfrSize);
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000);
|
||||
#else
|
||||
{
|
||||
int fd = open("/dev/mem", O_RDWR);
|
||||
|
||||
@@ -275,7 +242,6 @@ LXMapMem(ScrnInfoPtr pScrni)
|
||||
0xF0000);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
pGeode->FBBase = cim_fb_ptr;
|
||||
|
||||
@@ -295,27 +261,9 @@ LXMapMem(ScrnInfoPtr pScrni)
|
||||
static Bool
|
||||
LXCheckVGA(ScrnInfoPtr pScrni, EntityInfoPtr pEnt)
|
||||
{
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
unsigned char *ptr;
|
||||
const char *vgasig = "IBM VGA Compatible";
|
||||
int ret;
|
||||
|
||||
ptr =
|
||||
xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E,
|
||||
strlen(vgasig));
|
||||
|
||||
if (ptr == NULL)
|
||||
return FALSE;
|
||||
|
||||
ret = memcmp(ptr, vgasig, strlen(vgasig));
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig));
|
||||
|
||||
return ret ? FALSE : TRUE;
|
||||
#else
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pEnt->index);
|
||||
|
||||
return pci_device_is_boot_vga(pci);
|
||||
#endif
|
||||
}
|
||||
|
||||
static Bool
|
||||
@@ -341,10 +289,6 @@ LXPreInit(ScrnInfoPtr pScrni, int flags)
|
||||
return FALSE;
|
||||
|
||||
pEnt = xf86GetEntityInfo(pScrni->entityList[0]);
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
if (pEnt->resources)
|
||||
return FALSE;
|
||||
#endif
|
||||
if (flags & PROBE_DETECT) {
|
||||
GeodeProbeDDC(pScrni, pEnt->index);
|
||||
return TRUE;
|
||||
@@ -625,13 +569,6 @@ LXPreInit(ScrnInfoPtr pScrni, int flags)
|
||||
if (!xf86LoadSubModule(pScrni, "exa"))
|
||||
return FALSE;
|
||||
}
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) {
|
||||
xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
|
||||
"Couldn't register the resources.\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -652,14 +589,6 @@ LXRestore(ScrnInfoPtr pScrni)
|
||||
static Bool
|
||||
LXUnmapMem(ScrnInfoPtr pScrni)
|
||||
{
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_gp_ptr, LX_GP_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vg_ptr, LX_VG_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vid_ptr, LX_VID_REG_SIZE);
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vip_ptr, LX_VIP_REG_SIZE);
|
||||
|
||||
xf86UnMapVidMem(pScrni->scrnIndex, XpressROMPtr, 0x10000);
|
||||
#else
|
||||
GeodeRec *pGeode = GEODEPTR(pScrni);
|
||||
pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
|
||||
|
||||
@@ -670,7 +599,6 @@ LXUnmapMem(ScrnInfoPtr pScrni)
|
||||
unmap_pci_mem(pScrni, pci, cim_fb_ptr, pGeode->FBAvail + CIM_CMD_BFR_SZ);
|
||||
|
||||
munmap(XpressROMPtr, 0x10000);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user