Module Name: xsrc
Committed By: macallan
Date: Thu Oct 15 22:53:26 UTC 2009
Modified Files:
xsrc/external/mit/xf86-video-chips/dist/src: ct_driver.c ct_driver.h
Log Message:
make this work on shark again by enabling the VLB probe routines when HAVE_ISA
is defined. For now this disables the PCI probe routine but the only arch
where we actually need this is shark where we couldn't add a PCI CT65550 even
if we wanted to.
Tested on shark and macppc
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.3 xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.4
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.3 Fri Aug 21 23:51:02 2009
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c Thu Oct 15 22:53:26 2009
@@ -109,7 +109,7 @@
#include "micmap.h"
#include "fb.h"
-
+#include "xf86Priv.h"
/* Needed for the 1 and 4 bpp framebuffers */
#ifdef HAVE_XF1BPP
@@ -137,10 +137,9 @@
/* Mandatory functions */
static const OptionInfoRec * CHIPSAvailableOptions(int chipid, int busid);
static void CHIPSIdentify(int flags);
-#ifdef XSERVER_LIBPCIACCESS
static Bool CHIPSPciProbe(DriverPtr drv, int entity_num,
struct pci_device *dev, intptr_t match_data);
-#else
+#ifdef HAVE_ISA
static Bool CHIPSProbe(DriverPtr drv, int flags);
#endif
static Bool CHIPSPreInit(ScrnInfoPtr pScrn, int flags);
@@ -329,7 +328,7 @@
0xB3D0, /* DR0xC address of cursor pattern */
};
-#if defined(__arm32__) && defined(__NetBSD__)
+#if defined(__arm__) && defined(__NetBSD__)
/*
* Built in TV output modes: These modes have been tested on NetBSD with
* CT65550 and StrongARM. They give what seems to be the best output for
@@ -505,10 +504,10 @@
CHIPS_VERSION,
CHIPS_DRIVER_NAME,
CHIPSIdentify,
-#ifdef XSERVER_LIBPCIACCESS
- NULL,
-#else
+#ifdef HAVE_ISA
CHIPSProbe,
+#else
+ NULL,
#endif
CHIPSAvailableOptions,
NULL,
@@ -555,28 +554,6 @@
{ -1, -1, RES_UNDEFINED}
};
-#ifdef HAVE_ISA
-static IsaChipsets CHIPSISAchipsets[] = {
- { CHIPS_CT65520, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65525, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65530, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65535, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65540, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65545, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65546, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65548, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65550, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65554, RES_EXCLUSIVE_VGA },
- { CHIPS_CT65555, RES_EXCLUSIVE_VGA },
- { CHIPS_CT68554, RES_EXCLUSIVE_VGA },
- { CHIPS_CT69000, RES_EXCLUSIVE_VGA },
- { CHIPS_CT69030, RES_EXCLUSIVE_VGA },
- { CHIPS_CT64200, RES_EXCLUSIVE_VGA },
- { CHIPS_CT64300, RES_EXCLUSIVE_VGA },
- { -1, RES_UNDEFINED }
-};
-#endif
-
/* The options supported by the Chips and Technologies Driver */
typedef enum {
OPTION_LINEAR,
@@ -796,7 +773,6 @@
}
/* Mandatory */
-#ifdef XSERVER_LIBPCIACCESS
Bool
CHIPSPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev,
intptr_t match_data)
@@ -823,7 +799,7 @@
pScrn->ValidMode = CHIPSValidMode;
if (!CHIPSGetRec(pScrn)) {
- return FALSE;
+ return;
}
cPtr = CHIPSPTR(pScrn);
cPtr->Chipset = match_data;
@@ -860,15 +836,18 @@
return (pScrn != NULL);
}
-#else
+
+#ifdef HAVE_ISA
static Bool
CHIPSProbe(DriverPtr drv, int flags)
{
+ ScrnInfoPtr pScrn = NULL;
+ CHIPSPtr cPtr;
Bool foundScreen = FALSE;
int numDevSections, numUsed;
GDevPtr *devSections;
int *usedChips;
- int i;
+ int i, chipset, entity;
/*
* Find the config file Device sections that match this
@@ -878,89 +857,28 @@
&devSections)) <= 0) {
return FALSE;
}
- /* PCI BUS */
- if (xf86GetPciVideoInfo() ) {
- numUsed = xf86MatchPciInstances(CHIPS_NAME, PCI_VENDOR_CHIPSTECH,
- CHIPSChipsets, CHIPSPCIchipsets,
- devSections,numDevSections, drv,
- &usedChips);
- if (numUsed > 0) {
- if (flags & PROBE_DETECT)
- foundScreen = TRUE;
- else for (i = 0; i < numUsed; i++) {
- EntityInfoPtr pEnt;
- /* Allocate a ScrnInfoRec */
- ScrnInfoPtr pScrn = NULL;
- if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i],
- CHIPSPCIchipsets,NULL,
- NULL,NULL,NULL,NULL))){
- pScrn->driverVersion = CHIPS_VERSION;
- pScrn->driverName = CHIPS_DRIVER_NAME;
- pScrn->name = CHIPS_NAME;
- pScrn->Probe = CHIPSProbe;
- pScrn->PreInit = CHIPSPreInit;
- pScrn->ScreenInit = CHIPSScreenInit;
- pScrn->SwitchMode = CHIPSSwitchMode;
- pScrn->AdjustFrame = CHIPSAdjustFrame;
- pScrn->EnterVT = CHIPSEnterVT;
- pScrn->LeaveVT = CHIPSLeaveVT;
- pScrn->FreeScreen = CHIPSFreeScreen;
- pScrn->ValidMode = CHIPSValidMode;
- foundScreen = TRUE;
- }
- /*
- * For cards that can do dual head per entity, mark the entity
- * as sharable.
- */
- pEnt = xf86GetEntityInfo(usedChips[i]);
- if (pEnt->chipset == CHIPS_CT69030) {
- CHIPSEntPtr cPtrEnt = NULL;
- DevUnion *pPriv;
-
- xf86SetEntitySharable(usedChips[i]);
- /* Allocate an entity private if necessary */
- if (CHIPSEntityIndex < 0)
- CHIPSEntityIndex = xf86AllocateEntityPrivateIndex();
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- CHIPSEntityIndex);
- if (!pPriv->ptr) {
- pPriv->ptr = xnfcalloc(sizeof(CHIPSEntRec), 1);
- cPtrEnt = pPriv->ptr;
- cPtrEnt->lastInstance = -1;
- } else {
- cPtrEnt = pPriv->ptr;
- }
- /*
- * Set the entity instance for this instance of the
- * driver. For dual head per card, instance 0 is the
- * "master" instance, driving the primary head, and
- * instance 1 is the "slave".
- */
- cPtrEnt->lastInstance++;
- xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
- cPtrEnt->lastInstance);
+ /* Isa Bus */
+ if ((numDevSections =
+ xf86MatchDevice(CHIPS_DRIVER_NAME, &devSections)) > 0) {
+ for (i = 0; i < numDevSections; i++) {
+ if ((chipset = chipsFindIsaDevice(devSections[i])) > -1) {
+ if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+ xf86AddBusDeviceToConfigure(CHIPS_DRIVER_NAME, BUS_ISA,
+ NULL, chipset);
+ }
+ if (flags & PROBE_DETECT) {
+ return TRUE;
+ }
+ if (!xf86CheckStrOption(devSections[i]->options, "BusID",
+ "ISA")) {
+ continue;
}
- }
- xfree(usedChips);
- }
- }
-
-#ifdef HAVE_ISA
- /* Isa Bus */
- numUsed = xf86MatchIsaInstances(CHIPS_NAME,CHIPSChipsets,CHIPSISAchipsets,
- drv,chipsFindIsaDevice,devSections,
- numDevSections,&usedChips);
- if (numUsed > 0) {
- if (flags & PROBE_DETECT)
- foundScreen = TRUE;
- else for (i = 0; i < numUsed; i++) {
- ScrnInfoPtr pScrn = NULL;
- if ((pScrn = xf86ConfigIsaEntity(pScrn,0,
- usedChips[i],
- CHIPSISAchipsets,NULL,
- NULL,NULL,NULL,NULL))) {
+ pScrn = NULL;
+ entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
+ pScrn = xf86ConfigFbEntity(NULL, 0, entity, NULL, NULL,
+ NULL, NULL);
pScrn->driverVersion = CHIPS_VERSION;
pScrn->driverName = CHIPS_DRIVER_NAME;
pScrn->name = CHIPS_NAME;
@@ -973,19 +891,19 @@
pScrn->LeaveVT = CHIPSLeaveVT;
pScrn->FreeScreen = CHIPSFreeScreen;
pScrn->ValidMode = CHIPSValidMode;
- foundScreen = TRUE;
+ if (!CHIPSGetRec(pScrn)) {
+ return;
+ }
+ cPtr = CHIPSPTR(pScrn);
+ cPtr->Chipset = chipset;
}
- xfree(usedChips);
}
}
-#endif
xfree(devSections);
return foundScreen;
}
-#endif
-#ifdef HAVE_ISA
static int
chipsFindIsaDevice(GDevPtr dev)
{
@@ -2432,7 +2350,7 @@
"FP clock set to %7.3f MHz\n",
(float)(cPtr->FPclock / 1000.));
-#if defined(__arm32__) && defined(__NetBSD__)
+#if defined(__arm__) && defined(__NetBSD__)
ChipsPALMode.next = pScrn->monitor->Modes;
pScrn->monitor->Modes = &ChipsNTSCMode;
#endif
@@ -3944,7 +3862,7 @@
DUALOPEN;
}
-#if defined(__arm32__) && defined(__NetBSD__)
+#if defined(__arm__) && defined(___NetBSD__)
if (strcmp(pScrn->currentMode->name,"PAL") == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using built-in PAL TV mode\n");
cPtr->TVMode = XMODE_PAL;
@@ -4130,7 +4048,7 @@
if (pBankInfo == NULL)
return FALSE;
-#if defined(__arm32__)
+#if defined(__arm__)
cPtr->Bank = -1;
#endif
pBankInfo->pBankA = hwp->Base;
@@ -5772,7 +5690,7 @@
}
}
-#if defined(__arm32__) && defined(__NetBSD__)
+#if defined(__arm__) && defined(___NetBSD__)
if (cPtr->TVMode != XMODE_RGB) {
/*
* Put the console into TV Out mode.
@@ -7072,14 +6990,21 @@
VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L);
#else
{
- void** result = (void**)&cPtr->MMIOBase;
- int err = pci_device_map_range(cPtr->PciInfo,
+ if (cPtr->pEnt->location.type == BUS_PCI) {
+ void** result = (void**)&cPtr->MMIOBase;
+ int err = pci_device_map_range(cPtr->PciInfo,
cPtr->IOAddress,
0x20000L,
PCI_DEV_MAP_FLAG_WRITABLE,
result);
- if (err)
- return FALSE;
+ if (err) {
+ xf86Msg(X_ERROR, "PCI mmap failed\n");
+ return FALSE;
+ }
+ } else
+ cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex,
+ VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L);
+
}
#endif
} else {
@@ -7093,14 +7018,20 @@
VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x10000L);
#else
{
- void** result = (void**)&cPtr->MMIOBase;
- int err = pci_device_map_range(cPtr->PciInfo,
+ if (cPtr->pEnt->location.type == BUS_PCI) {
+ void** result = (void**)&cPtr->MMIOBase;
+ int err = pci_device_map_range(cPtr->PciInfo,
cPtr->IOAddress,
0x10000L,
PCI_DEV_MAP_FLAG_WRITABLE,
result);
- if (err)
- return FALSE;
+ if (err) {
+ xf86Msg(X_ERROR, "PCI mmap failed\n");
+ return FALSE;
+ }
+ } else
+ cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex,
+ VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x10000L);
}
#endif
}
@@ -7134,7 +7065,7 @@
cPtr->FbBase = xf86MapVidMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER,
Addr, Map);
#else
- {
+ if (cPtr->pEnt->location.type == BUS_PCI) {
void** result = (void**)&cPtr->FbBase;
int err = pci_device_map_range(cPtr->PciInfo,
Addr,
@@ -7142,9 +7073,13 @@
PCI_DEV_MAP_FLAG_WRITABLE |
PCI_DEV_MAP_FLAG_WRITE_COMBINE,
result);
- if (err)
- return FALSE;
- }
+ if (err) {
+ xf86Msg(X_ERROR, "PCI mmap fb failed\n");
+ return FALSE;
+ }
+ } else
+ cPtr->FbBase = xf86MapVidMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER,
+ Addr, Map);
#endif
Index: xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h:1.1.1.2 xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h:1.2
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h:1.1.1.2 Wed Jun 10 00:46:36 2009
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.h Thu Oct 15 22:53:26 2009
@@ -342,7 +342,7 @@
CHIPSEntPtr entityPrivate;
unsigned char storeMSS;
unsigned char storeIOSS;
-#ifdef __arm32__
+#ifdef __arm__
#ifdef __NetBSD__
int TVMode;
#endif