summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2008-07-17 21:37:50 +0300
committerDaniel Stone <daniel@fooishbar.org>2008-07-17 21:37:50 +0300
commit446fe9eecddd1337f9d5164dd7c301e1ba3dfe32 (patch)
treee749fe520d2226df0397a407e7353c065bbc5248 /hw
parent0564b5454ac101d9e1218767bbbc2c2d9f3e0696 (diff)
Dead code removal
Remove a whole bunch of code that was never built, be it entire files or just dead ifdefs.
Diffstat (limited to 'hw')
-rw-r--r--hw/kdrive/fbdev/fbdev.c6
-rw-r--r--hw/xfree86/i2c/xf86i2c.c24
-rw-r--r--hw/xfree86/os-support/Makefile.am2
-rw-r--r--hw/xfree86/os-support/bus/460gxPCI.c469
-rw-r--r--hw/xfree86/os-support/bus/460gxPCI.h41
-rw-r--r--hw/xfree86/os-support/bus/altixPCI.c83
-rw-r--r--hw/xfree86/os-support/bus/altixPCI.h20
-rw-r--r--hw/xfree86/os-support/bus/e8870PCI.c63
-rw-r--r--hw/xfree86/os-support/bus/e8870PCI.h41
-rw-r--r--hw/xfree86/os-support/bus/zx1PCI.c1140
-rw-r--r--hw/xfree86/os-support/bus/zx1PCI.h39
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c10
-rw-r--r--hw/xfree86/os-support/usl/Makefile.am6
-rw-r--r--hw/xfree86/os-support/usl/usl_init.c357
-rw-r--r--hw/xfree86/os-support/usl/usl_iop.c106
-rw-r--r--hw/xfree86/os-support/usl/usl_video.c109
-rw-r--r--hw/xfree86/os-support/usl/usl_vtsw.c95
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h32
-rw-r--r--hw/xfree86/parser/Makefile.am3
-rw-r--r--hw/xfree86/parser/cpconfig.c122
-rw-r--r--hw/xfree86/parser/scan.c3
-rw-r--r--hw/xfree86/parser/write.c9
22 files changed, 12 insertions, 2768 deletions
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index fcc3267e4..35ca4dec6 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -99,8 +99,6 @@ fbdevCardInit (KdCardInfo *card)
return TRUE;
}
-#define FBDEV_KLUDGE_FORMAT
-#ifdef FBDEV_KLUDGE_FORMAT
static Pixel
fbdevMakeContig (Pixel orig, Pixel others)
{
@@ -114,7 +112,6 @@ fbdevMakeContig (Pixel orig, Pixel others)
}
return orig;
}
-#endif
static Bool
fbdevModeSupported (KdScreenInfo *screen,
@@ -261,7 +258,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
-#ifdef FBDEV_KLUDGE_FORMAT
+
/*
* This is a kludge so that Render will work -- fill in the gaps
* in the pixel
@@ -278,7 +275,6 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->fb[0].redMask|
screen->fb[0].greenMask);
-#endif
allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
depth = 32;
while (depth && !(allbits & (1 << (depth - 1))))
diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
index 5cc83faa3..59832d6f9 100644
--- a/hw/xfree86/i2c/xf86i2c.c
+++ b/hw/xfree86/i2c/xf86i2c.c
@@ -35,12 +35,6 @@
#define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */
#define I2C_TRACE(x) /*(x)*/ /* Report progress */
-/* Set which OSs have bad gettimeofday resolution. */
-#if defined(SVR4) && !defined(sun)
-#define BAD_GETTIMEOFDAY_RESOLUTION
-#endif
-
-
/* This is the default I2CUDelay function if not supplied by the driver.
* High level I2C interfaces implementing the bus protocol in hardware
* should supply this function too.
@@ -49,23 +43,6 @@
* All values 0 to 1e6 inclusive must be expected.
*/
-#ifdef BAD_GETTIMEOFDAY_RESOLUTION
-/*
- * This is temporary until a better, portable
- * way is found. Adjust bogo_usec to match CPU speed.
- */
-static int bogo_usec = 500;
-
-static void
-I2CUDelay(I2CBusPtr b, int usec)
-{
- volatile long i;
-
- if (usec > 0)
- for (i = usec * bogo_usec; i > 0; i--)
- /* (perhaps hw delay action) */;
-}
-#else
static void
I2CUDelay(I2CBusPtr b, int usec)
{
@@ -86,7 +63,6 @@ I2CUDelay(I2CBusPtr b, int usec)
} while (diff>=0 && diff< (usec + 1));
}
}
-#endif
/* Most drivers will register just with GetBits/PutBits functions.
* The following functions implement a software I2C protocol
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index aecc44696..7128244de 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -1,5 +1,5 @@
SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
-DIST_SUBDIRS = bsd bus misc linux solaris sysv sco usl hurd
+DIST_SUBDIRS = bsd bus misc linux solaris sysv sco hurd
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h assyntax.h
diff --git a/hw/xfree86/os-support/bus/460gxPCI.c b/hw/xfree86/os-support/bus/460gxPCI.c
deleted file mode 100644
index 44ee97687..000000000
--- a/hw/xfree86/os-support/bus/460gxPCI.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/*
- * This file contains the glue necessary for support of Intel's 460GX chipset.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "460gxPCI.h"
-#include "xf86.h"
-#include "Pci.h"
-
-/* 460GX register definitions */
-/* SAC at 0:10:0 */
-#define CBN 0x0040
-/* SAC at CBN:0:0 */
-#define DEVNPRES 0x0070
-/* SAC at CBN:1[0-7]:0 */
-#define BUSNO 0x0048
-#define SUBNO 0x0049
-#define VGASE 0x0080
-#define PCIS 0x0084
-#define IOR 0x008C
-#define IORD 0x008E /* CBN:10:0 only */
-/* PXB at CBN:1[0-7]:1 */
-#define ERRCMD 0x0046
-
-static int cbn_460gx = -1;
-static CARD32 cbdevs_460gx = 0;
-static CARD16 iord_460gx;
-static int busno_460gx[8], subno_460gx[8];
-static CARD8 pcis_460gx[8], ior_460gx[8];
-static CARD8 has_err_460gx[8], err_460gx[8];
-static CARD8 iomap_460gx[16]; /* One for each 4k */
-static pciBusFuncs_t BusFuncs_460gx;
-
-static pciConfigPtr
-Verify460GXBus(int bus)
-{
- pciConfigPtr pPCI;
-
- if ((bus < 0) || (bus >= pciNumBuses) ||
- !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) ||
- (pPCI->busnum != cbn_460gx) || (pPCI->funcnum != 0) ||
- (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17))
- return NULL;
-
- return pPCI;
-}
-
-/*
- * This function is called to emulate the various settings in a P2P or CardBus
- * bridge's control register using one of a 460GX's SAC host bridges.
- */
-static CARD16
-Control460GXBridge(int bus, CARD16 mask, CARD16 value)
-{
- pciConfigPtr pPCI;
- PCITAG tag;
- CARD16 current = 0;
- CARD8 tmp;
-
- if ((pPCI = Verify460GXBus(bus))) {
- /* Start with VGA enablement */
- tmp = pciReadByte(pPCI->tag, VGASE);
- if (tmp & 0x01) {
- current |= PCI_PCI_BRIDGE_VGA_EN;
- if ((mask & PCI_PCI_BRIDGE_VGA_EN) &&
- !(value & PCI_PCI_BRIDGE_VGA_EN))
- pciWriteByte(pPCI->tag, VGASE, tmp & ~0x01);
- } else {
- if (mask & value & PCI_PCI_BRIDGE_VGA_EN)
- pciWriteByte(pPCI->tag, VGASE, tmp | 0x01);
- }
-
- /* Move on to master abort failure enablement */
- if (has_err_460gx[pPCI->devnum - 0x10]) {
- tag = PCI_MAKE_TAG(pPCI->busnum, pPCI->devnum, pPCI->funcnum + 1);
- tmp = pciReadByte(tag, ERRCMD);
- if (tmp & 0x01) {
- current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN;
- if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) &&
- !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN))
- pciWriteByte(tag, ERRCMD, tmp & ~0x01);
- } else {
- if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)
- pciWriteByte(tag, ERRCMD, tmp | 0x01);
- }
- }
-
- /* Put emulation of any other P2P bridge control here */
- }
-
- return (current & ~mask) | (value & mask);
-}
-
-/*
- * Retrieve various bus numbers representing the connections provided by 460GX
- * host bridges.
- */
-static void
-Get460GXBridgeBuses(int bus, int *primary, int *secondary, int *subordinate)
-{
- pciConfigPtr pPCI = Verify460GXBus(bus);
- int i;
-
- /* The returned bus numbers are initialised by the caller */
-
- if (!pPCI)
- return;
-
- i = pPCI->devnum - 0x10;
-
- /* These are not modified, so no need to re-read them */
- if (primary)
- *primary = pPCI->busnum;
- if (secondary)
- *secondary = busno_460gx[i];
- if (subordinate)
- *subordinate = subno_460gx[i];
-}
-
-/* Retrieves a list of the resources routed to a host bridge's secondary bus */
-static void
-Get460GXBridgeResources(int bus,
- pointer *ppIoRes,
- pointer *ppMemRes,
- pointer *ppPmemRes)
-{
- pciConfigPtr pPCI = Verify460GXBus(bus);
- resRange range;
- unsigned int i, j;
-
- if (ppIoRes) {
- xf86FreeResList(*ppIoRes);
- *ppIoRes = NULL;
-
- if (pPCI) {
- for (i = 0; i <= 0x0F; i++) {
- if (iomap_460gx[i] != pPCI->devnum)
- continue;
-
- RANGE(range, i << 12, ((i + 1) << 12) - 1,
- RANGE_TYPE(ResExcIoBlock, 0));
- *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1);
- }
- }
- }
-
- if (ppMemRes) {
- xf86FreeResList(*ppMemRes);
- *ppMemRes = NULL;
-
- if (pPCI) {
- if (!(i = (pPCI->devnum - 0x10)))
- j = 127; /* (4GB - 32M) / 32M */
- else
- j = pcis_460gx[i - 1] & 0x7F;
-
- i = pcis_460gx[i] & 0x7F;
- if (i < j) {
- RANGE(range, i << 25, (j << 25) - 1,
- RANGE_TYPE(ResExcMemBlock, 0));
- *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1);
- }
- }
- }
-
- if (ppPmemRes) {
- xf86FreeResList(*ppPmemRes);
- *ppPmemRes = NULL;
- }
-}
-
-/*
- * This checks for, and validates, the presence of the 460GX chipset, and sets
- * cbn_460gx to a positive value accordingly. This function returns TRUE if
- * the chipset scan is to be stopped, or FALSE if the scan is to move on to the
- * next chipset.
- */
-
-Bool
-xorgProbe460GX(scanpciWrapperOpt flags)
-{
- pciBusInfo_t *pBusInfo;
- PCITAG tag;
-
- /* Bus zero should already be set up */
- if (!(pBusInfo = pciBusInfo[0])) {
- cbn_460gx = -1;
- return FALSE;
- }
- /* First look for a 460GX's primary host bridge */
- tag = PCI_MAKE_TAG(0, 0x10, 0);
- if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
- return TRUE;
- }
-
- cbn_460gx = -1;
-
- return FALSE;
-}
-
-void
-xf86PreScan460GX(void)
-{
- pciBusInfo_t *pBusInfo;
- PCITAG tag;
- CARD32 tmp;
- int i, devno;
-
- if (!(pBusInfo = pciBusInfo[0]))
- return;
-
- /* Get CBN (Chipset bus number) */
- tag = PCI_MAKE_TAG(0, 0x10, 0);
- if (!(cbn_460gx = (unsigned int)pciReadByte(tag, CBN))) {
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
-
- if (pciNumBuses <= cbn_460gx)
- pciNumBuses = cbn_460gx + 1;
-
- /* Set up bus CBN */
- if (!pciBusInfo[cbn_460gx]) {
- pciBusInfo[cbn_460gx] = xnfalloc(sizeof(pciBusInfo_t));
- *pciBusInfo[cbn_460gx] = *pBusInfo;
- }
-
- tag = PCI_MAKE_TAG(cbn_460gx, 0, 0);
- if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
-
- /*
- * Find out which CBN devices the firmware thinks are present. Of these,
- * we are only interested in devices 0x10 through 0x17.
- */
- cbdevs_460gx = pciReadLong(tag, DEVNPRES);
-
- for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) {
- tag = PCI_MAKE_TAG(cbn_460gx, devno, 0);
- if (pciReadLong(tag, PCI_ID_REG) !=
- DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) {
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
-
- if (devno == 0x10)
- iord_460gx = pciReadWord(tag, IORD);
-
- busno_460gx[i] = (unsigned int)pciReadByte(tag, BUSNO);
- subno_460gx[i] = (unsigned int)pciReadByte(tag, SUBNO);
- pcis_460gx[i] = pciReadByte(tag, PCIS);
- ior_460gx[i] = pciReadByte(tag, IOR);
-
- has_err_460gx[i] = err_460gx[i] = 0; /* Insurance */
-
- tag = PCI_MAKE_TAG(cbn_460gx, devno, 1);
- tmp = pciReadLong(tag, PCI_ID_REG);
- switch (tmp) {
- case DEVID(VENDOR_INTEL, CHIP_460GX_PXB):
- case DEVID(VENDOR_INTEL, CHIP_460GX_WXB):
- if (cbdevs_460gx & (1 << devno)) {
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
-
- /*
- * XXX I don't have WXB docs, but PCI register dumps indicate that
- * the registers we are interested in are consistent with those of
- * the PXB.
- */
- err_460gx[i] = pciReadByte(tag, ERRCMD);
- has_err_460gx[i] = 1;
- break;
-
- case DEVID(VENDOR_INTEL, CHIP_460GX_GXB_1):
- if (cbdevs_460gx & (1 << devno)) {
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
-
- /*
- * XXX GXB isn't documented to have an ERRCMD register, nor any
- * other means of failing master aborts. For now, assume master
- * aborts are always allowed to complete normally.
- */
- break;
-
- default:
- if (((CARD16)(tmp + 1U) <= (CARD16)1U) &&
- (cbdevs_460gx & (1U << devno)))
- break;
- /* Sanity check failed */
- cbn_460gx = -1;
- return;
- }
- }
-
- /* Allow master aborts to complete normally */
- for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) {
- if (!(err_460gx[i] & 0x01))
- continue;
-
- pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1),
- ERRCMD, err_460gx[i] & ~0x01);
- }
-
- /*
- * The 460GX spec says that any access to buses higher than CBN will be
- * master-aborted. It seems possible however that this is not the case in
- * all 460GX implementations. For now, limit the bus scan to CBN, unless
- * we have already found a higher bus number.
- */
- for (i = 0; subno_460gx[i] < cbn_460gx; ) {
- if (++i < 8)
- continue;
-
- pciMaxBusNum = cbn_460gx + 1;
- break;
- }
-
- return;
-}
-
-/* This does some 460GX-related processing after the PCI bus scan */
-void
-xf86PostScan460GX(void)
-{
- pciConfigPtr pPCI, *ppPCI;
- pciBusInfo_t *pBusInfo;
- int i, j, devno;
-
- if (cbn_460gx <= 0)
- return;
-
- /* Set up our extra bus functions */
- BusFuncs_460gx = *(pciBusInfo[0]->funcs);
- BusFuncs_460gx.pciControlBridge = Control460GXBridge;
- BusFuncs_460gx.pciGetBridgeBuses = Get460GXBridgeBuses;
- BusFuncs_460gx.pciGetBridgeResources = Get460GXBridgeResources;
-
- /*
- * Mark all host bridges so that they are ignored by the upper-level
- * xf86GetPciBridgeInfo() function. This marking is later clobbered by the
- * tail end of xf86scanpci() for those bridges that actually have bus
- * segments associated with them.
- */
- ppPCI = xf86scanpci(0); /* Recursion is only apparent */
- while ((pPCI = *ppPCI++)) {
- if ((pPCI->pci_base_class == PCI_CLASS_BRIDGE) &&
- (pPCI->pci_sub_class == PCI_SUBCLASS_BRIDGE_HOST))
- pPCI->businfo = HOST_NO_BUS;
- }
-
- ppPCI = xf86scanpci(0); /* Recursion is only apparent */
- j = 0;
-
- /*
- * Fix up CBN bus linkage. This is somewhat arbitrary. The bridge chosen
- * for this must be a CBN device so that bus CBN can be recognised as the
- * root segment. It also cannot be any of the bus expanders (devices
- * CBN:0x10:0 through CBN:0x17:0 nor any of their functions). For now, we
- * chose the SAC host bridge at CBN:0:0.
- */
- pBusInfo = pciBusInfo[cbn_460gx];
- pBusInfo->bridge = pciBusInfo[0]->bridge; /* Just in case */
- while ((pPCI = *ppPCI++)) {
- if (pPCI->busnum < cbn_460gx)
- continue;
- if (pPCI->busnum > cbn_460gx)
- break;
- if (pPCI->devnum < 0)
- continue;
- if (pPCI->devnum > 0)
- break;
- if (pPCI->funcnum < 0)
- continue;
- if (pPCI->funcnum > 0)
- break;
-
- pBusInfo->bridge = pPCI;
- pBusInfo->secondary = FALSE;
- pBusInfo->primary_bus = cbn_460gx;
- break;
- }
-
- for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) {
- /* Restore ERRCMD registers */
- if (err_460gx[i] & 0x01)
- pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1),
- ERRCMD, err_460gx[i]);
-
- if (!(cbdevs_460gx & (1 << devno))) {
- while ((pPCI = *ppPCI++)) {
- if (pPCI->busnum < cbn_460gx)
- continue;
- if (pPCI->busnum > cbn_460gx)
- break;
- if (pPCI->devnum < devno)
- continue;
- if (pPCI->devnum > devno)
- break;
- if (pPCI->funcnum < 0)
- continue;
- if (pPCI->funcnum > 0)
- break;
-
- if ((pBusInfo == pciBusInfo[busno_460gx[i]]))
- break;
-
- /* Fix bus linkage */
- pBusInfo->bridge = pPCI;
- pBusInfo->secondary = TRUE;
- pBusInfo->primary_bus = cbn_460gx;
-
- /* Plug in chipset routines */
- pBusInfo->funcs = &BusFuncs_460gx;
- break;
- }
- }
-
- /* Decode IOR registers */
- for(; j <= (ior_460gx[i] & 0x0F); j++)
- iomap_460gx[j] = devno;
- }
-
- /* The bottom 4k of I/O space is always routed to PCI0a */
- iomap_460gx[0] = 0x10;
-
- /* Decode IORD register */
- for (j = 1; j <= 0x0F; j++)
- if (iord_460gx & (1 << j))
- iomap_460gx[j] = 0x10;
-}
diff --git a/hw/xfree86/os-support/bus/460gxPCI.h b/hw/xfree86/os-support/bus/460gxPCI.h
deleted file mode 100644
index 2905d4787..000000000
--- a/hw/xfree86/os-support/bus/460gxPCI.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef PCI_460GX_H
-#define PCI_460GX_H 1
-
-#include <X11/Xdefs.h>
-#include <Pci.h>
-
-Bool xorgProbe460GX(scanpciWrapperOpt flags);
-void xf86PreScan460GX(void);
-void xf86PostScan460GX(void);
-
-#endif
diff --git a/hw/xfree86/os-support/bus/altixPCI.c b/hw/xfree86/os-support/bus/altixPCI.c
deleted file mode 100644
index bab255e4d..000000000
--- a/hw/xfree86/os-support/bus/altixPCI.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This file contains the glue necessary for support of SGI's Altix chipset.
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include "altixPCI.h"
-#include "xf86.h"
-#include "Pci.h"
-
-void xf86PreScanAltix(void)
-{
- /* Nothing to see here... */
-}
-
-void xf86PostScanAltix(void)
-{
- pciConfigPtr *pdev;
- int idx, free_idx;
-
- /*
- * Some altix pci chipsets do not expose themselves as host
- * bridges.
- *
- * Walk the devices looking for buses for which there is not a
- * corresponding pciDevice entry (ie. pciBusInfo[]->bridge is NULL).
- *
- * It is assumed that this indicates a root bridge for which we will
- * construct a fake pci host bridge device.
- */
-
- pdev = xf86scanpci(0);
- for (idx = 0; pdev[idx] != NULL; idx++)
- ;
-
- free_idx = idx;
-
- for (idx = 0; idx < free_idx; idx++) {
- pciConfigPtr dev, fakedev;
- pciBusInfo_t *businfo;
-
- dev = pdev[idx];
- businfo = pciBusInfo[dev->busnum];
-
- if (! businfo) {
- /* device has no bus ... should this be an error? */
- continue;
- }
-
- if (businfo->bridge) {
- /* bus has a device ... no need for fixup */
- continue;
- }
-
- if (free_idx >= MAX_PCI_DEVICES)
- FatalError("SN: No room for fake root bridge device\n");
-
- /*
- * Construct a fake device and stick it at the end of the
- * pdev array. Make it look like a host bridge.
- */
- fakedev = xnfcalloc(1, sizeof(pciDevice));
- fakedev->tag = PCI_MAKE_TAG(dev->busnum, 0, 0);;
- fakedev->busnum = dev->busnum;
- fakedev->devnum = 0;
- fakedev->funcnum = 0;
- fakedev->fakeDevice = 1;
- /* should figure out a better DEVID */
- fakedev->pci_device_vendor = DEVID(VENDOR_GENERIC, CHIP_VGA);
- fakedev->pci_base_class = PCI_CLASS_BRIDGE;
-
- businfo->secondary = 0;
- businfo->primary_bus = dev->busnum;
- businfo->bridge = fakedev;
-
- fakedev->businfo = businfo;
-
- pdev[free_idx++] = fakedev;
- }
-}
diff --git a/hw/xfree86/os-support/bus/altixPCI.h b/hw/xfree86/os-support/bus/altixPCI.h
deleted file mode 100644
index 2a738f362..000000000
--- a/hw/xfree86/os-support/bus/altixPCI.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef PCI_ALTIX_H
-#define PCI_ALTIX_H 1
-
-#include <X11/Xdefs.h>
-#include <Pci.h>
-
-Bool xorgProbeAltix(scanpciWrapperOpt flags);
-void xf86PreScanAltix(void);
-void xf86PostScanAltix(void);
-
-/* Some defines for PCI */
-#define VENDOR_SGI 0x10A9
-#define CHIP_TIO_CA 0x1010
-#define CHIP_PIC_PCI 0x1011
-
-#endif
diff --git a/hw/xfree86/os-support/bus/e8870PCI.c b/hw/xfree86/os-support/bus/e8870PCI.c
deleted file mode 100644
index 8e0f95ac0..000000000
--- a/hw/xfree86/os-support/bus/e8870PCI.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/*
- * This file contains the glue necessary for support of Intel's E8870 chipset.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "e8870PCI.h"
-#include "xf86.h"
-#include "Pci.h"
-
-Bool
-xorgProbeE8870(scanpciWrapperOpt flags)
-{
- PCITAG tag;
-
- /* Look for an E8870's Hub interface */
- tag = PCI_MAKE_TAG(0, 0x1E, 0);
- if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_82801_P2P))
- return TRUE;
-
- return FALSE;
-}
-
-void
-xf86PreScanE8870(void)
-{
- /* XXX Fill me in... */
- return;
-}
-
-void
-xf86PostScanE8870(void)
-{
- /* XXX Fill me in... */
-}
diff --git a/hw/xfree86/os-support/bus/e8870PCI.h b/hw/xfree86/os-support/bus/e8870PCI.h
deleted file mode 100644
index 89726270a..000000000
--- a/hw/xfree86/os-support/bus/e8870PCI.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef PCI_E8870_H
-#define PCI_E8870_H 1
-
-#include <X11/Xdefs.h>
-#include <Pci.h>
-
-Bool xorgProbeE8870(scanpciWrapperOpt flags);
-void xf86PreScanE8870(void);
-void xf86PostScanE8870(void);
-
-#endif
diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c
deleted file mode 100644
index d78e0c434..000000000
--- a/hw/xfree86/os-support/bus/zx1PCI.c
+++ /dev/null
@@ -1,1140 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/*
- * This file contains the glue necessary for support of HP's ZX1 chipset.
- * Keep in mind that this chipset is used in both Itanium2 and PA-RISC
- * architectures.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "zx1PCI.h"
-#include "xf86.h"
-#include "xf86_OSlib.h"
-#include "Pci.h"
-
-#define MIO_BASE 0xFED00000UL /* mio register base */
-#define MIO_SIZE 0x00002000UL /* 8k, minimum */
-
-/* ZX1 mio register definitions */
-#define MIO_FUNCTION0 0x0000U
-
-#define MODULE_INFO 0x0100U
-#define STATUS_CONTROL 0x0108U
-#define DILLON_PRESENT 0x02UL
-
-#define LMMIO_DIR_BASE0 0x0300U
-#define LMMIO_DIR_MASK0 0x0308U
-#define LMMIO_DIR_ROUTE0 0x0310U
-#define LMMIO_DIR_BASE1 0x0318U
-#define LMMIO_DIR_MASK1 0x0320U
-#define LMMIO_DIR_ROUTE1 0x0328U
-#define LMMIO_DIR_BASE2 0x0330U
-#define LMMIO_DIR_MASK2 0x0338U
-#define LMMIO_DIR_ROUTE2 0x0340U
-#define LMMIO_DIR_BASE3 0x0348U
-#define LMMIO_DIR_MASK3 0x0350U
-#define LMMIO_DIR_ROUTE3 0x0358U
-#define LMMIO_DIST_BASE 0x0360U
-#define LMMIO_DIST_MASK 0x0368U
-#define LMMIO_DIST_ROUTE 0x0370U
-#define GMMIO_DIST_BASE 0x0378U
-#define PORT_DISABLE 0x02UL
-#define MAP_TO_LMMIO 0x04UL
-#define GMMIO_DIST_MASK 0x0380U
-#define GMMIO_DIST_ROUTE 0x0388U
-#define IOS_DIST_BASE 0x0390U
-#define IOS_DIST_MASK 0x0398U
-#define IOS_DIST_ROUTE 0x03A0U
-#define ROPE_CONFIG_BASE 0x03A8U
-#define VGA_ROUTE 0x03B0U
-#define VGA_ENABLE 0x8000000000000000UL
-#define VGA_LIGHT 0x4000000000000000UL
-
-#define IOS_DIR_BASE 0x03C0U
-#define IOS_DIR_MASK 0x03C8U
-#define IOS_DIR_ROUTE 0x03D0U
-#define IOS_BASE 0x03D8U
-
-#define MIO_FUNCTION1 0x1000U
-
-#define ROPE_CONFIG 0x1040U
-#define ROPE_D0 0x0100UL
-#define ROPE_D2 0x0200UL
-#define ROPE_D4 0x0400UL
-#define ROPE_D6 0x0800UL
-#define ROPE_Q0 0x1000UL
-#define ROPE_Q4 0x2000UL
-
-#define LBA_PORT0_CNTRL 0x1200U
-#define LBA_PORT1_CNTRL 0x1208U
-#define LBA_PORT2_CNTRL 0x1210U
-#define LBA_PORT3_CNTRL 0x1218U
-#define LBA_PORT4_CNTRL 0x1220U
-#define LBA_PORT5_CNTRL 0x1228U
-#define LBA_PORT6_CNTRL 0x1230U
-#define LBA_PORT7_CNTRL 0x1238U
-#define LBA_RESET_FUNCTION 0x0000000001UL
-#define LBA_CLEAR_ERROR 0x0000000010UL
-#define LBA_HARD_FAIL 0x0000000040UL
-#define LBA_RESET_COMPLETE 0x0100000000UL
-#define LBA_RESET_TIMEOUT 0x0200000000UL
-
-#define ROPE_PAGE_CONTROL 0x1418U
-
-/*
- * Total ioa configuration space size is actually 128k, but we only need the
- * first 64k.
- */
-#define IOA_SIZE 0x00010000UL
-
-/* ZX1 ioa register definitions */
-#define IOA_CONFIG_ADDR 0x0040U
-#define IOA_CONFIG_DATA 0x0048U
-
-#define IOA_SECONDARY_BUS 0x0058U
-#define IOA_SUBORDINATE_BUS 0x0059U
-
-#define IOA_CONTROL 0x0108U
-#define IOA_RESET_FUNCTION 0x0000000001UL
-#define IOA_FORWARD_VGA 0x0000000008UL
-#define IOA_CLEAR_ERROR 0x0000000010UL
-#define IOA_HARD_FAIL 0x0000000040UL
-#define IOA_RESET_COMPLETE 0x0100000000UL
-
-#define IOA_LMMIO_BASE 0x0200U
-#define IOA_LMMIO_MASK 0x0208U
-#define IOA_GMMIO_BASE 0x0210U
-#define IOA_GMMIO_MASK 0x0218U
-#define IOA_WLMMIO_BASE 0x0220U
-#define IOA_WLMMIO_MASK 0x0228U
-#define IOA_WGMMIO_BASE 0x0230U
-#define IOA_WGMMIO_MASK 0x0238U
-#define IOA_IOS_BASE 0x0240U
-#define IOA_IOS_MASK 0x0248U
-#define IOA_ELMMIO_BASE 0x0250U
-#define IOA_ELMMIO_MASK 0x0258U
-#define IOA_EIOS_BASE 0x0260U
-#define IOA_EIOS_MASK 0x0268U
-#define IOA_GLOBAL_MASK 0x0270U
-#define IOA_SLAVE_CONTROL 0x0278U
-#define IOA_VGA_PEER_ENABLE 0x2000UL
-#define IOA_MSI_BASE 0x0280U
-#define IOA_MSI_MASK 0x0288U
-
-#define IOA_DMA_BASE 0x02B0U
-#define IOA_DMA_MASK 0x02B8U
-
-#define IOA_ERROR_CONFIG 0x0680U
-#define IOA_ERROR_PIOWRITE 0x0001UL
-#define IOA_ERROR_PIOREAD 0x0002UL
-#define IOA_ERROR_DMAWRITE 0x0004UL
-#define IOA_ERROR_DMAREAD 0x0008UL
-#define IOA_ERROR_CONFIG_MASTER 0x0010UL
-#define IOA_ERROR_SMART 0x0020UL
-#define IOA_ERROR_FATAL_SERR 0x0040UL
-#define IOA_ERROR_ASSERT_SERR 0x0080UL
-/* ? 0x0100UL */
-#define IOA_ERROR_LOOPBACK 0x0200UL
-#define IOA_ERROR_CONFIG_TARGET 0x0400UL
-#define IOA_ERROR_IO_MASTER 0x0800UL
-#define IOA_ERROR_IO_TARGET 0x1000UL
-#define IOA_ERROR_MEM_MASTER 0x2000UL
-#define IOA_ERROR_MEM_TARGET 0x4000UL
-#define IOA_ERROR_HF_IO_FATAL 0x8000UL
-
-#define RANGE_ENABLE 0x01UL /* In various base registers */
-
-#define IO_MASK ((1UL << 16) - 1UL)
-#define LMMIO_MASK ((1UL << 32) - 1UL)
-#ifdef __ia64__
-#define GMMIO_MASK ((1UL << 44) - 1UL)
-#else /* PA-RISC */
-#define GMMIO_MASK ((1UL << 40) - 1UL)
-#endif
-
-#define PDH_START 0xFF000000UL
-#define PDH_LAST 0xFFFFFFFFUL
-
-static CARD8 *pZX1mio = NULL,
- *pZX1ioa = NULL;
-
-/* Per-rope data */
-static INT8 zx1_ropemap[8];
-static CARD32 zx1_pciids[8];
-static CARD64 zx1_lbacntl[8];
-static int zx1_busno[8], zx1_subno[8];
-
-/* Array of Booleans for non-empty buses */
-static INT8 zx1_busnmpt[MAX_PCI_BUSES];
-
-static pciBusFuncs_t zx1BusFuncs;
-static int zx1_fakebus = -1;
-static Bool zx1_hasvga = FALSE;
-
-static pointer pZX1IoRes[8], pZX1MemRes[8]; /* Rope resources */
-
-/* Non-PCI configuration space access macros */
-#define MIO_BYTE(offset) \
- (*(volatile CARD8 *)(pointer)(pZX1mio + (offset)))
-#define MIO_WORD(offset) \
- (*(volatile CARD16 *)(pointer)(pZX1mio + (offset)))
-#define MIO_LONG(offset) \
- (*(volatile CARD32 *)(pointer)(pZX1mio + (offset)))
-#define MIO_QUAD(offset) \
- (*(volatile CARD64 *)(pointer)(pZX1mio + (offset)))
-#define IOA_BYTE(ioa, offset) \
- (*(volatile CARD8 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13))))
-#define IOA_WORD(ioa, offset) \
- (*(volatile CARD16 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13))))
-#define IOA_LONG(ioa, offset) \
- (*(volatile CARD32 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13))))
-#define IOA_QUAD(ioa, offset) \
- (*(volatile CARD64 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13))))
-
-/* Range definitions */
-#define MAX_RANGE 16
-static CARD64 bot[MAX_RANGE], top[MAX_RANGE], msk[MAX_RANGE], siz[MAX_RANGE];
-static INT8 *pDecode[MAX_RANGE];
-static int nRange = 0;
-
-/* Track a resource range and assign a granularity to it */
-static void
-SetRange(CARD64 base, CARD64 last, CARD8 width)
-{
- int i;
-
- bot[nRange] = base;
- top[nRange] = last;
- msk[nRange] = (CARD64)(-1L);
- if (base)
- msk[nRange] &= (base ^ (base - 1UL)) >> 1;
- if (last + 1UL)
- msk[nRange] &= (last ^ (last + 1UL)) >> 1;
- if (width < 64)
- msk[nRange] &= (1UL << width) - 1UL;
-
- /* Look for overlapping ranges */
- for (i = 0; i < nRange; i++) {
- if ((bot[i] > top[i]) ||
- (top[nRange] < bot[i]) ||
- (top[i] < bot[nRange]))
- continue;
-
- /* Merge in overlapping range */
- if (bot[nRange] > bot[i])
- bot[nRange] = bot[i];
- if (top[nRange] < top[i])
- top[nRange] = top[i];
-
- /* Assign finer granularity */
- msk[nRange] &= msk[i];
- bot[i] = 1UL;
- top[i] = 0;
- }
-
- nRange++;
-}
-
-/* Lookup granularity associated with the range containing 'base' */
-static int
-GetRange(CARD64 base)
-{
- int i;
-
- for (i = 0; i < nRange; i++) {
- if ((bot[i] > top[i]) ||
- (base < bot[i]) ||
- (base > top[i]))
- continue;
-
- if (pDecode[i])
- break;
-
- /* Allocate decoding array */
- msk[i]++;
- siz[i] = ((top[i] - bot[i] + 1UL) / msk[i]) + 1UL;
- pDecode[i] = xnfalloc(siz[i]);
- (void)memset(pDecode[i], -1, siz[i]);
- break;
- }
-
- return i;
-}
-
-/*
- * Verify that 'bus' is a rope's secondary bus and return the pciConfigPtr of
- * the associated fake PCI-to-PCI bridge.
- */
-static pciConfigPtr
-VerifyZX1Bus(int bus)
-{
- pciConfigPtr pPCI;
-
- if ((bus < 0) || (bus >= pciNumBuses) ||
- !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) ||
- (pPCI->busnum != zx1_fakebus) || (pPCI->funcnum != 0) ||
- (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17))
- return NULL;
-
- return pPCI;
-}
-
-/*
- * This function is called to emulate the various settings in a P2P or CardBus
- * bridge's control register on a ZX1-based system.
- */
-static CARD16
-ControlZX1Bridge(int bus, CARD16 mask, CARD16 value)
-{
- pciConfigPtr pPCI;
- CARD64 tmp1, tmp2, tmp3, ropenum;
- CARD16 current = 0;
-
- if ((pPCI = VerifyZX1Bus(bus))) {
- ropenum = pPCI->devnum & 0x07;
-
- /*
- * Start with VGA enablement. This preserves the "VGA-lite" bit
- * in mio's VGA_ROUTE register, and the VPE bit in each ioa's
- * SLAVE_CONTROL register.
- */
- tmp1 = MIO_QUAD(VGA_ROUTE);
- tmp2 = IOA_QUAD(ropenum, IOA_CONTROL) &
- ~(IOA_RESET_FUNCTION | IOA_CLEAR_ERROR);
- if ((tmp1 & VGA_ENABLE) && ((tmp1 & 0x07UL) == ropenum)) {
- current |= PCI_PCI_BRIDGE_VGA_EN;
- if ((mask & PCI_PCI_BRIDGE_VGA_EN) &&
- !(value & PCI_PCI_BRIDGE_VGA_EN)) {
- MIO_QUAD(VGA_ROUTE) = tmp1 & ~VGA_ENABLE;
- tmp2 &= ~IOA_FORWARD_VGA;
- IOA_QUAD(ropenum, IOA_CONTROL) = tmp2;
- }
- } else if (mask & value & PCI_PCI_BRIDGE_VGA_EN) {
- if (!zx1_hasvga) {
- xf86MsgVerb(X_WARNING, 3,
- "HP ZX1: Attempt to enable VGA routing to bus %d"
- " through rope %ld disallowed\n", bus, ropenum);
- value &= ~PCI_PCI_BRIDGE_VGA_EN;
- } else {
- if (tmp1 & VGA_ENABLE) {
- /*
- * VGA is routed somewhere else. Disable it.
- */
- MIO_QUAD(VGA_ROUTE) = 0UL;
- tmp3 = IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL);
- if (tmp3 & IOA_FORWARD_VGA)
- IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL) = tmp3 &
- ~(IOA_RESET_FUNCTION | IOA_FORWARD_VGA |
- IOA_CLEAR_ERROR);
- }
- if (!(tmp2 & IOA_FORWARD_VGA)) {
- tmp2 |= IOA_FORWARD_VGA;
- IOA_QUAD(ropenum, IOA_CONTROL) = tmp2;
- }
- tmp1 = (tmp1 & ~0x07UL) | ropenum | VGA_ENABLE;
- MIO_QUAD(VGA_ROUTE) = tmp1;
- }
- }
-
- /* Move on to master abort failure enablement */
- tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) &
- ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR);
- if ((tmp1 & LBA_HARD_FAIL) || (tmp2 & IOA_HARD_FAIL)) {
- current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN;
- if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) &&
- !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) {
- if (tmp1 & LBA_HARD_FAIL)
- MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) =
- tmp1 & ~LBA_HARD_FAIL;
- if (tmp2 & IOA_HARD_FAIL) {
- tmp2 &= ~IOA_HARD_FAIL;
- IOA_QUAD(ropenum, IOA_CONTROL) = tmp2;
- }
- }
- } else {
- if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) {
- if (!(tmp1 & LBA_HARD_FAIL))
- MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) =
- tmp1 | LBA_HARD_FAIL;
- if (!(tmp2 & IOA_HARD_FAIL)) {
- tmp2 |= IOA_HARD_FAIL;
- IOA_QUAD(ropenum, IOA_CONTROL) = tmp2;
- }
- }
- }
-
- /* Put emulation of any other P2P bridge control here */
- }
-
- return (current & ~mask) | (value & mask);
-}
-
-/* Retrieves a list of the resources routed to a rope's secondary bus */
-static void
-GetZX1BridgeResources(int bus,
- pointer *ppIoRes,
- pointer *ppMemRes,
- pointer *ppPmemRes)
-{
- pciConfigPtr pPCI = VerifyZX1Bus(bus);
-
- if (ppIoRes) {
- xf86FreeResList(*ppIoRes);
- *ppIoRes =
- pPCI ? xf86DupResList(pZX1IoRes[pPCI->devnum & 0x07]) : NULL;
- }
-
- if (ppMemRes) {
- xf86FreeResList(*ppMemRes);
- *ppMemRes =
- pPCI ? xf86DupResList(pZX1MemRes[pPCI->devnum & 0x07]) : NULL;
- }
-
- if (ppPmemRes) {
- xf86FreeResList(*ppPmemRes);
- *ppPmemRes = NULL;
- }
-}
-
-/* The fake bus */
-static CARD32
-zx1FakeReadLong(PCITAG tag, int offset)
-{
- FatalError("zx1FakeReadLong(0x%lX, 0x%X) called\n",
- (unsigned long)tag, offset);
-}
-
-static void
-zx1FakeWriteLong(PCITAG tag, int offset, CARD32 val)
-{
- FatalError("zx1FakeWriteLong(0x%lX, 0x%X, 0x%08X) called\n",
- (unsigned long)tag, offset, val);
-}
-
-static void
-zx1FakeSetBits(PCITAG tag, int offset, CARD32 mask, CARD32 bits)
-{
- CARD32 val;
-
- val = zx1FakeReadLong(tag, offset);
- val &= ~mask;
- val |= bits;
- zx1FakeWriteLong(tag, offset, val);
-}
-
-static pciBusFuncs_t zx1FakeBusFuncs = {
- zx1FakeReadLong,
- zx1FakeWriteLong,
- zx1FakeSetBits
-};
-
-static pciBusInfo_t zx1FakeBus = {
- 0, /* configMech -- copied from bus 0 */
- 0, /* numDevices -- copied from bus 0 */
- FALSE, /* secondary */
- 0, /* primary_bus -- dynamically set */
- &zx1FakeBusFuncs, /* funcs */
- NULL, /* pciBusPriv -- none */
- NULL, /* bridge -- dynamically set */
-};
-
-void
-xf86PreScanZX1(void)
-{
- resRange range;
- unsigned long mapSize = getpagesize();
- unsigned long tmp, base, ioaaddr;
- unsigned long flagsd, based, lastd, maskd, routed;
- unsigned long flags0, base0, last0, mask0, route0;
- unsigned long flags1, base1, last1, mask1, route1;
- unsigned long flags2, base2, last2, mask2, route2;
- unsigned long flags3, base3, last3, mask3, route3;
- unsigned long flagsg, baseg, lastg, maskg, routeg;
- unsigned long flagsl, basel, lastl;
- int i, rope;
-
- /* Map mio registers (minimum 8k) */
- if (mapSize < MIO_SIZE)
- mapSize = MIO_SIZE;
-
- if (!(pZX1mio = xf86MapVidMem(-1, VIDMEM_MMIO, MIO_BASE, mapSize)))
- return;
-
- /* Look for ZX1's SBA and IOC */
- if (((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) !=
- DEVID(VENDOR_HP, CHIP_ZX1_SBA)) ||
- (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) !=
- DEVID(VENDOR_HP, CHIP_ZX1_IOC))) &&
- ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) !=
- DEVID(VENDOR_HP, CHIP_ZX2_SBA)) ||
- (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) !=
- DEVID(VENDOR_HP, CHIP_ZX2_IOC)))) {
- xf86UnMapVidMem(-1, pZX1mio, mapSize);
- pZX1mio = NULL;
- return;
- }
-
- /* Map rope configuration space */
- ioaaddr = MIO_QUAD(ROPE_CONFIG_BASE);
- if (!(ioaaddr & RANGE_ENABLE) || /* No ropes */
- ((ioaaddr = ioaaddr & ~RANGE_ENABLE) & 0x01FFFFUL) || /* Not aligned */
- !(pZX1ioa = xf86MapVidMem(-1, VIDMEM_MMIO, ioaaddr, IOA_SIZE))) {
- xf86UnMapVidMem(-1, pZX1mio, mapSize);
- pZX1mio = NULL;
- return;
- }
-
- for (i = 0; i < 8; i++) {
- zx1_ropemap[i] = i;
- zx1_lbacntl[i] = 0;
- xf86FreeResList(pZX1IoRes[i]);
- xf86FreeResList(pZX1MemRes[i]);
- pZX1IoRes[i] = pZX1MemRes[i] = NULL;
- }
-
- /*
- * Determine which of 8 possible ropes exist in the system. This is done
- * by looking at their "coupling" to generate a list of candidates,
- * whittling this list down by factoring in ROPE_PAGE_CONTROL register
- * contents, then poking each candidate's configuration space to determine
- * its existence.
- */
- tmp = MIO_QUAD(ROPE_CONFIG);
- if (tmp & ROPE_D0)
- zx1_ropemap[1] = 0;
- if (tmp & ROPE_D2)
- zx1_ropemap[3] = 2;
- if (tmp & ROPE_D4)
- zx1_ropemap[5] = 4;
- if (tmp & ROPE_D6)
- zx1_ropemap[7] = 6;
- if (tmp & ROPE_Q0)
- zx1_ropemap[1] = zx1_ropemap[2] = zx1_ropemap[3] = 0;
- if (tmp & ROPE_Q4)
- zx1_ropemap[5] = zx1_ropemap[6] = zx1_ropemap[7] = 4;
-
- /*
- * zx2 should allow better probing support via hard-fails, so no need to
- * use the ROPE_PAGE_CONTROL register. Also, zx2 always has ropes 3 & 7
- * active regardless of bundling.
- */
- if (MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) !=
- DEVID(VENDOR_HP, CHIP_ZX2_SBA)) {
-
- tmp = MIO_QUAD(ROPE_PAGE_CONTROL);
- for (i = 0; i < 8; i++, tmp >>= 8)
- if (!(CARD8)tmp)
- zx1_ropemap[i] = -1;
- } else {
- zx1_ropemap[3] = 3;
- zx1_ropemap[7] = 7;
- }
-
- for (i = 0; i < 8; ) {
- if (zx1_ropemap[i] == i) {
-
- /* Prevent hard-fails */
- zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) &
- ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR);
-
- if (zx1_lbacntl[i] & LBA_RESET_TIMEOUT) {
- /* Ignore this rope and its couplings */
- do {
- zx1_ropemap[i++] = -1;
- } while ((i < 8) && (zx1_ropemap[i] < i));
- continue; /* Avoid over-incrementing 'i' */
- }
-
- if (zx1_lbacntl[i] & LBA_HARD_FAIL)
- MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) =
- zx1_lbacntl[i] & ~LBA_HARD_FAIL;
-
- /* Poke for an ioa */
- zx1_pciids[i] = IOA_LONG(i, PCI_ID_REG);
- switch (zx1_pciids[i]) {
- case DEVID(VENDOR_HP, CHIP_ELROY):
- case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */
- case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */
- case DEVID(VENDOR_HP, CHIP_ZX2_LBA):
- case DEVID(VENDOR_HP, CHIP_ZX2_PCIE):
- /* Expected vendor/device IDs */
- zx1_busno[i] =
- (unsigned int)IOA_BYTE(i, IOA_SECONDARY_BUS);
- zx1_subno[i] =
- (unsigned int)IOA_BYTE(i, IOA_SUBORDINATE_BUS);
- break;
-
- default:
- if ((CARD16)(zx1_pciids[i] + 1U) > (CARD16)1U)
- xf86MsgVerb(X_NOTICE, 0,
- "HP ZX1: Unexpected vendor/device id 0x%08X"
- " on rope %d\n", zx1_pciids[i], i);
- /* Nobody home, or not the "right" kind of rope guest */
-
- /*
- * Restore hard-fail setting. For "active" ropes, this is done
- * later.
- */
- if (zx1_lbacntl[i] & LBA_HARD_FAIL) {
- MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i];
- zx1_lbacntl[i] = 0;
- }
-
- /* Ignore this rope and its couplings */
- do {
- zx1_ropemap[i++] = -1;
- } while ((i < 8) && (zx1_ropemap[i] < i));
- continue; /* Avoid over-incrementing 'i' */
- }
- }
- i++;
- }
-
- /* Determine if VGA is currently routed */
- tmp = MIO_QUAD(VGA_ROUTE);
- if (tmp & VGA_ENABLE)
- zx1_hasvga = TRUE;
-
- /*
- * Decode mio resource "coarse" routing (i.e. ignoring VGA). Due to the
- * rather unusual flexibility of this chipset, this is done in a number of
- * stages. For each of I/O and memory, first decode the relevant registers
- * to generate ranges with an associated granularity. Overlapping ranges
- * are merged into a larger range with the finer granularity. Each
- * original range is then more thoroughly decoded using the granularity
- * associated with the merged range that contains it. The result is then
- * converted into resource lists for the common layer.
- *
- * Note that this doesn't care whether or not read-only bits are actually
- * set as documented, nor that mask bits are contiguous. This does,
- * however, factor in upper limits on I/O, LMMIO anf GMMIO addresses, and
- * thus assumes high-order address bits are ignored rather than decoded.
- * For example, an I/O address of 0x76543210 will be treated as 0x3210
- * rather than considered out-of-range. In part, this handling is a
- * consequence of the fact that high-order mask bits are zeroes instead of
- * ones.
- */
-
- flagsd = 0; based = 0; lastd = 0; maskd = 0; routed = 0;
- flags0 = 0; base0 = 0; last0 = 0; mask0 = 0; route0 = 0;
- flags1 = 0; base1 = 0; last1 = 0; mask1 = 0; route1 = 0;
- flags2 = 0; base2 = 0; last2 = 0; mask2 = 0; route2 = 0;
- flags3 = 0; base3 = 0; last3 = 0; mask3 = 0; route3 = 0;
- flagsg = 0; baseg = 0; lastg = 0; maskg = 0; routeg = 0;
- flagsl = 0; basel = 0; lastl = 0;
-
- if ((tmp = MIO_QUAD(IOS_DIST_BASE)) & RANGE_ENABLE) {
- flagsd = RANGE_ENABLE;
- maskd = MIO_QUAD(IOS_DIST_MASK);
- based = tmp & maskd & (~RANGE_ENABLE & IO_MASK);
- lastd = based | (~maskd & IO_MASK);
- routed = MIO_QUAD(IOS_DIST_ROUTE) >> 58;
- SetRange(based, lastd, routed);
- }
-
- if ((tmp = MIO_QUAD(IOS_DIR_BASE)) & RANGE_ENABLE) {
- flags0 = RANGE_ENABLE;
- mask0 = MIO_QUAD(IOS_DIR_MASK);
- base0 = tmp & mask0 & (~RANGE_ENABLE & IO_MASK);
- last0 = base0 | (~mask0 & IO_MASK);
- route0 = MIO_QUAD(IOS_DIR_ROUTE) & 0x07U;
- SetRange(base0, last0, 64);
- }
-
- if (flagsd) {
- i = GetRange(based);
- for (tmp = based; tmp <= lastd; tmp += msk[i]) {
- if ((tmp & maskd) == based) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U];
- }
- }
-
- flagsd = 0;
- }
-
- if (flags0) {
- i = GetRange(base0);
- for (tmp = base0; tmp <= last0; tmp += msk[i]) {
- if ((tmp & mask0) == base0) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[route0];
- }
- }
-
- flags0 = 0;
- }
-
- for (i = 0; i < nRange; i++) {
- if (!pDecode[i])
- continue;
-
- rope = pDecode[i][0];
- for (base = tmp = 0; ++tmp < siz[i]; ) {
- if (rope == pDecode[i][tmp])
- continue;
-
- if (rope >= 0) {
- RANGE(range, (base * msk[i]) + bot[i],
- (tmp * msk[i]) + bot[i] - 1UL,
- RANGE_TYPE(ResExcIoBlock, 0));
- pZX1IoRes[rope] =
- xf86AddResToList(pZX1IoRes[rope], &range, -1);
- }
-
- base = tmp;
- rope = pDecode[i][base];
- }
-
- xfree(pDecode[i]);
- pDecode[i] = NULL;
- }
-
- nRange = 0;
-
- /*
- * Move on to CPU memory access decoding. For now, don't tell the common
- * layer about CPU memory ranges that are either relocated to 0 or
- * translated into PCI I/O.
- */
-
- SetRange(MIO_BASE, MIO_BASE + MIO_SIZE - 1UL, 64); /* mio */
- SetRange(ioaaddr, ioaaddr + ((IOA_SIZE << 1) - 1UL), 64); /* ioa */
- SetRange(PDH_START, PDH_LAST, 64); /* PDH */
-
- SetRange(MIO_BASE, LMMIO_MASK, 64); /* Completeness */
-
- if ((tmp = MIO_QUAD(LMMIO_DIST_BASE)) & RANGE_ENABLE) {
- flagsd = RANGE_ENABLE;
- maskd = MIO_QUAD(LMMIO_DIST_MASK);
- based = tmp & maskd & (~RANGE_ENABLE & LMMIO_MASK);
- lastd = based | (~maskd & LMMIO_MASK);
- routed = MIO_QUAD(LMMIO_DIST_ROUTE) >> 58;
- SetRange(based, lastd, routed);
- }
-
- if ((tmp = MIO_QUAD(LMMIO_DIR_BASE0)) & RANGE_ENABLE) {
- flags0 = RANGE_ENABLE;
- mask0 = MIO_QUAD(LMMIO_DIR_MASK0);
- base0 = tmp & mask0 & (~RANGE_ENABLE & LMMIO_MASK);
- last0 = base0 | (~mask0 & LMMIO_MASK);
- route0 = MIO_QUAD(LMMIO_DIR_ROUTE0) & 0x07U;
- SetRange(base0, last0, 64);
- }
-
- if ((tmp = MIO_QUAD(LMMIO_DIR_BASE1)) & RANGE_ENABLE) {
- flags1 = RANGE_ENABLE;
- mask1 = MIO_QUAD(LMMIO_DIR_MASK1);
- base1 = tmp & mask1 & (~RANGE_ENABLE & LMMIO_MASK);
- last1 = base1 | (~mask1 & LMMIO_MASK);
- route1 = MIO_QUAD(LMMIO_DIR_ROUTE1) & 0x07U;
- SetRange(base1, last1, 64);
- }
-
- if ((tmp = MIO_QUAD(LMMIO_DIR_BASE2)) & RANGE_ENABLE) {
- flags2 = RANGE_ENABLE;
- mask2 = MIO_QUAD(LMMIO_DIR_MASK2);
- base2 = tmp & mask2 & (~RANGE_ENABLE & LMMIO_MASK);
- last2 = base2 | (~mask2 & LMMIO_MASK);
- route2 = MIO_QUAD(LMMIO_DIR_ROUTE2) & 0x07U;
- SetRange(base2, last2, 64);
- }
-
- if ((tmp = MIO_QUAD(LMMIO_DIR_BASE3)) & RANGE_ENABLE) {
- flags3 = RANGE_ENABLE;
- mask3 = MIO_QUAD(LMMIO_DIR_MASK3);
- base3 = tmp & mask3 & (~RANGE_ENABLE & LMMIO_MASK);
- last3 = base3 | (~mask3 & LMMIO_MASK);
- route3 = MIO_QUAD(LMMIO_DIR_ROUTE3) & 0x07U;
- SetRange(base3, last3, 64);
- }
-
- if ((tmp = MIO_QUAD(GMMIO_DIST_BASE)) & RANGE_ENABLE) {
- flagsg = tmp & (RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO);
- maskg = MIO_QUAD(GMMIO_DIST_MASK);
- baseg = tmp & maskg &
- (~(RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO) & GMMIO_MASK);
- lastg = baseg | (~maskg & GMMIO_MASK);
- tmp = routeg = MIO_QUAD(GMMIO_DIST_ROUTE) >> 58;
- if (!(flagsg & (PORT_DISABLE & MAP_TO_LMMIO)) && (tmp > 26))
- tmp = 26;
- SetRange(baseg, lastg, tmp);
- }
-
- if ((tmp = MIO_QUAD(IOS_BASE)) & RANGE_ENABLE) {
- flagsl = RANGE_ENABLE;
- basel = tmp & (~RANGE_ENABLE & GMMIO_MASK);
- lastl = basel | 0x001FFFFFUL;
- SetRange(basel, lastl, 64);
- }
-
- if (flagsd) {
- i = GetRange(based);
- for (tmp = based; tmp <= lastd; tmp += msk[i]) {
- if ((tmp & maskd) == based) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U];
- }
- }
-
- flagsd = 0;
- }
-
- /* LMMIO distributed range does not address anything beyond 0xFED00000 */
- i = GetRange(MIO_BASE);
- for (tmp = MIO_BASE; tmp <= LMMIO_MASK; tmp += msk[i]) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = -1;
- }
-
- /* Dillon space can sometimes be redirected to rope 0 */
- tmp = MIO_QUAD(STATUS_CONTROL);
- if (!(tmp & DILLON_PRESENT)) {
- i = GetRange(PDH_START);
- for (tmp = PDH_START; tmp <= PDH_LAST; tmp += msk[i]) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[0];
- }
- }
-
- if (flagsg) {
- unsigned long mask = (0x07UL << routeg) | maskg;
-
- i = GetRange(baseg);
- for (tmp = baseg; tmp <= lastg; tmp += msk[i]) {
- if ((tmp & maskg) == baseg) {
- base = (tmp - bot[i]) / msk[i];
-
- if ((flagsg & MAP_TO_LMMIO) ||
- (!(flagsg & PORT_DISABLE) &&
- (tmp <= ((tmp & mask) | 0x03FFFFFFUL)))) {
- pDecode[i][base] = -1;
- } else {
- pDecode[i][base] = zx1_ropemap[(tmp >> routeg) & 0x07U];
- }
- }
- }
-
- flagsg = 0;
- }
-
- if (flagsl) {
- i = GetRange(basel);
- for (tmp = basel; tmp <= lastl; tmp += msk[i]) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = -1;
- }
-
- flagsl = 0;
- }
-
- /* For now, assume directed LMMIO ranges don't overlap with each other */
- if (flags0) {
- i = GetRange(base0);
- for (tmp = base0; tmp <= last0; tmp += msk[i]) {
- if ((tmp & mask0) == base0) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[route0];
- }
- }
-
- flags0 = 0;
- }
-
- if (flags1) {
- i = GetRange(base1);
- for (tmp = base1; tmp <= last1; tmp += msk[i]) {
- if ((tmp & mask1) == base1) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[route1];
- }
- }
-
- flags1 = 0;
- }
-
- if (flags2) {
- i = GetRange(base2);
- for (tmp = base2; tmp <= last2; tmp += msk[i]) {
- if ((tmp & mask2) == base2) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[route2];
- }
- }
-
- flags2 = 0;
- }
-
- if (flags3) {
- i = GetRange(base3);
- for (tmp = base3; tmp <= last3; tmp += msk[i]) {
- if ((tmp & mask3) == base3) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = zx1_ropemap[route3];
- }
- }
-
- flags3 = 0;
- }
-
- /* Claim iao config area */
- i = GetRange(ioaaddr);
- for (tmp = ioaaddr; tmp < ioaaddr + (IOA_SIZE << 1); tmp += msk[i]) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = -1;
- }
-
- /* Claim mio config area */
- i = GetRange(MIO_BASE);
- for (tmp = MIO_BASE; tmp < (MIO_BASE + MIO_SIZE); tmp += msk[i]) {
- base = (tmp - bot[i]) / msk[i];
- pDecode[i][base] = -1;
- }
-
- for (i = 0; i < nRange; i++) {
- if (!pDecode[i])
- continue;
-
- rope = pDecode[i][0];
- for (base = tmp = 0; ++tmp < siz[i]; ) {
- if (rope == pDecode[i][tmp])
- continue;
-
- if (rope >= 0) {
- RANGE(range, (base * msk[i]) + bot[i],
- (tmp * msk[i]) + bot[i] - 1UL,
- RANGE_TYPE(ResExcMemBlock, 0));
- pZX1MemRes[rope] =
- xf86AddResToList(pZX1MemRes[rope], &range, -1);
- }
-
- base = tmp;
- rope = pDecode[i][base];
- }
-
- xfree(pDecode[i]);
- pDecode[i] = NULL;
- }
-
- nRange = 0;
-
- return;
-}
-
-/* This is called to finalise the results of a PCI bus scan */
-void
-xf86PostScanZX1(void)
-{
- pciConfigPtr pPCI, *ppPCI, *ppPCI2;
- pciBusInfo_t *pBusInfo;
- int i, idx;
-
- if (!pZX1mio)
- return;
-
- (void)memset(zx1_busnmpt, FALSE, sizeof(zx1_busnmpt));
- pBusInfo = pciBusInfo[0];
-
- /*
- * Certain 2.4 & 2.5 Linux kernels add fake PCI devices. Remove them to
- * prevent any possible interference with our PCI validation.
- *
- * Also, if VGA isn't routed on server entry, determine if VGA routing
- * needs to be enabled while the server is running.
- */
- idx = 0;
- ppPCI = ppPCI2 = xf86scanpci(0); /* Recursion is only apparent */
- while ((pPCI = *ppPCI2++)) {
- switch (pPCI->pci_device_vendor) {
- case DEVID(VENDOR_HP, CHIP_ELROY):
- case DEVID(VENDOR_HP, CHIP_ZX1_SBA): /* Pluto function 0 */
- case DEVID(VENDOR_HP, CHIP_ZX1_IOC): /* Pluto function 1 */
- case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */
- case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */
- case DEVID(VENDOR_HP, CHIP_ZX2_SBA):
- case DEVID(VENDOR_HP, CHIP_ZX2_IOC):
- case DEVID(VENDOR_HP, CHIP_ZX2_LBA):
- case DEVID(VENDOR_HP, CHIP_ZX2_PCIE):
- xfree(pPCI); /* Remove it */
- continue;
-
- default:
- *ppPCI++ = pPCI;
- idx++;
-
- zx1_busnmpt[pPCI->busnum] = TRUE;
-
- if (zx1_hasvga)
- continue;
-
- switch (pPCI->pci_base_class) {
- case PCI_CLASS_PREHISTORIC:
- if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA)
- break;
- continue;
-
- case PCI_CLASS_DISPLAY:
- if (pPCI->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA)
- break;
- continue;
-
- default:
- continue;
- }
-
- zx1_hasvga = TRUE;
- continue;
- }
- }
-
- /*
- * Restore hard-fail settings and figure out the actual secondary and
- * subordinate bus numbers.
- */
- for (i = 0; i < 8; i++) {
- if (zx1_ropemap[i] != i)
- continue;
-
- if (zx1_lbacntl[i] & LBA_HARD_FAIL)
- MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i];
-
- while ((zx1_busno[i] < zx1_subno[i]) && !pciBusInfo[zx1_subno[i]])
- zx1_subno[i]--;
-
- if (zx1_fakebus <= zx1_subno[i])
- zx1_fakebus = zx1_subno[i] + 1;
-
- while (!zx1_busnmpt[zx1_busno[i]]) {
- if (zx1_busno[i]) /* Info for bus zero is in static storage */
- xfree(pciBusInfo[zx1_busno[i]]);
- pciBusInfo[zx1_busno[i]++] = NULL;
- if (zx1_busno[i] > zx1_subno[i])
- break;
- }
- }
-
- if (zx1_fakebus >= pciNumBuses) {
- if (zx1_fakebus >= pciMaxBusNum)
- FatalError("HP ZX1: No room for fake PCI bus\n");
- pciNumBuses = zx1_fakebus + 1;
- }
-
- /* Set up our extra bus functions */
- zx1BusFuncs = *(pBusInfo->funcs);
- zx1BusFuncs.pciControlBridge = ControlZX1Bridge;
- zx1BusFuncs.pciGetBridgeResources = GetZX1BridgeResources;
-
- /* Set up our own fake bus to act as the root segment */
- zx1FakeBus.configMech = pBusInfo->configMech;
- zx1FakeBus.numDevices = pBusInfo->numDevices;
- zx1FakeBus.primary_bus = zx1_fakebus;
- pciBusInfo[zx1_fakebus] = &zx1FakeBus;
-
- /* Add the fake bus' host bridge */
- if (++idx >= MAX_PCI_DEVICES)
- FatalError("HP ZX1: No room for fake Host-to-PCI bridge\n");
- *ppPCI++ = zx1FakeBus.bridge = pPCI = xnfcalloc(1, sizeof(pciDevice));
- pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, 0, 0);
- pPCI->busnum = zx1_fakebus;
- /* pPCI->devnum = pPCI->funcnum = 0; */
- pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_SBA);
- pPCI->pci_base_class = PCI_CLASS_BRIDGE;
- /* pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_HOST; */
- pPCI->fakeDevice = TRUE;
-
-#ifdef OLD_FORMAT
- xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x "
- "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n",
- pPCI->busnum, pPCI->devnum, pPCI->funcnum,
- pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id,
- pPCI->pci_base_class, pPCI->pci_sub_class);
-#else
- xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
- " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
- pPCI->busnum, pPCI->devnum, pPCI->funcnum,
- pPCI->pci_vendor, pPCI->_pci_device,
- pPCI->pci_subsys_vendor, pPCI->pci_subsys_card,
- pPCI->pci_rev_id, pPCI->pci_base_class,
- pPCI->pci_sub_class, pPCI->pci_prog_if,
- pPCI->pci_header_type);
-#endif
-
- /* Add a fake PCI-to-PCI bridge to represent each active rope */
- for (i = 0; i < 8; i++) {
- if ((zx1_ropemap[i] != i) || (zx1_busno[i] > zx1_subno[i]) ||
- !(pBusInfo = pciBusInfo[zx1_busno[i]]))
- continue;
-
- if (++idx >= MAX_PCI_DEVICES)
- FatalError("HP ZX1: No room for fake PCI-to-PCI bridge\n");
- *ppPCI++ = pPCI = xnfcalloc(1, sizeof(pciDevice));
- pPCI->busnum = zx1_fakebus;
- pPCI->devnum = i | 0x10;
- /* pPCI->funcnum = 0; */
- pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0);
- pPCI->pci_device_vendor = zx1_pciids[i];
- pPCI->pci_base_class = PCI_CLASS_BRIDGE;
- pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_PCI;
- pPCI->pci_header_type = 1;
- pPCI->pci_primary_bus_number = zx1_fakebus;
- pPCI->pci_secondary_bus_number = zx1_busno[i];
- pPCI->pci_subordinate_bus_number = zx1_subno[i];
- pPCI->fakeDevice = TRUE;
-
- pBusInfo->bridge = pPCI;
- pBusInfo->secondary = TRUE;
- pBusInfo->primary_bus = zx1_fakebus;
-
- /* Plug in chipset routines */
- pBusInfo->funcs = &zx1BusFuncs;
-
- /* Set bridge control register for scanpci utility */
- pPCI->pci_bridge_control = ControlZX1Bridge(zx1_busno[i], 0, 0);
-
-#ifdef OLD_FORMAT
- xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x "
- "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n",
- pPCI->busnum, pPCI->devnum, pPCI->funcnum,
- pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id,
- pPCI->pci_base_class, pPCI->pci_sub_class);
-#else
- xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
- " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
- pPCI->busnum, pPCI->devnum, pPCI->funcnum,
- pPCI->pci_vendor, pPCI->_pci_device,
- pPCI->pci_subsys_vendor, pPCI->pci_subsys_card,
- pPCI->pci_rev_id, pPCI->pci_base_class,
- pPCI->pci_sub_class, pPCI->pci_prog_if,
- pPCI->pci_header_type);
-#endif
- }
-
- *ppPCI = NULL; /* Terminate array */
-}
diff --git a/hw/xfree86/os-support/bus/zx1PCI.h b/hw/xfree86/os-support/bus/zx1PCI.h
deleted file mode 100644
index f2b279382..000000000
--- a/hw/xfree86/os-support/bus/zx1PCI.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef PCI_ZX1_H
-#define PCI_ZX1_H 1
-
-#include <X11/Xdefs.h>
-
-void xf86PreScanZX1(void);
-void xf86PostScanZX1(void);
-
-#endif
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 429593784..4c64fa447 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -75,19 +75,9 @@ extern int iopl(int __level);
#ifdef __alpha__
-# ifdef LIBC_IS_FIXED
extern void sethae(unsigned long hae);
-# else
-# include <unistd.h>
-# define sethae(x) syscall(301,x);
-# endif
-/* define to test the Sparse addressing on a non-Jensen */
-# ifdef TEST_JENSEN_CODE
-# define isJensen (1)
-# else
# define isJensen (axpSystem == JENSEN)
-# endif
# define BUS_BASE bus_base
diff --git a/hw/xfree86/os-support/usl/Makefile.am b/hw/xfree86/os-support/usl/Makefile.am
deleted file mode 100644
index db08f5d85..000000000
--- a/hw/xfree86/os-support/usl/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-EXTRA_DIST = \
- usl_init.c \
- usl_iop.c \
- usl_mouse.c \
- usl_video.c \
- usl_vtsw.c
diff --git a/hw/xfree86/os-support/usl/usl_init.c b/hw/xfree86/os-support/usl/usl_init.c
deleted file mode 100644
index d27b206c8..000000000
--- a/hw/xfree86/os-support/usl/usl_init.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright 2001-2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell, David Wexelblat
- * and Kean Johnston not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Thomas Roell, David Wexelblat and Kean Johnston make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL, DAVID WEXELBLAT AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
- * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- * THIS SOFTWARE.
- *
- */
-
-#include "X.h"
-#include "Xmd.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/utsname.h>
-
-static Bool KeepTty = FALSE;
-static Bool Protect0 = FALSE;
-static Bool CRTSpecified = FALSE;
-static int VTnum = -1;
-static char vtdevice[48];
-
-int usl_is_osr6 = -1;
-
-static Bool
-IsConsoleDevice(const char *dev)
-{
- if ((!strcmp (dev, "/dev/console")) ||
- (!strcmp (dev, "/dev/syscon")) ||
- (!strcmp (dev, "/dev/systty")))
- return TRUE;
-
- return FALSE;
-}
-
-static int
-is_osr6 (void)
-{
- struct utsname uts;
-
- if (usl_is_osr6 == -1) {
- if (uname (&uts) < 0) {
- FatalError ("get_usl_ver: Failed to determine UNIX name (%s)\n",
- strerror (errno));
- }
-
- if (uts.version[0] == '6')
- usl_is_osr6 = 1;
- else
- usl_is_osr6 = 0;
- }
-
- return usl_is_osr6;
-}
-
-
-void
-xf86OpenConsole(void)
-{
- int fd, i, ioctl_ret;
- struct vt_mode VT;
- struct vt_stat vts;
- MessageType from = X_PROBED;
- struct sigaction sigvtsw;
- char *ttn;
-
- if (serverGeneration == 1) {
- int isconsole = 0, consdev = 0;
-
- /* check if we're run with euid==0 */
- if (geteuid() != 0) {
- FatalError("xf86OpenConsole: Server must be suid root\n");
- }
-
- /* If we are run in the background we will get SIGTTOU. Ignore it. */
- OsSignal (SIGTTOU, SIG_IGN);
-
- /* Protect page 0 to help find NULL dereferencing */
- /* mprotect() doesn't seem to work */
- if (Protect0) {
- int fd = -1;
-
- if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) {
- xf86Msg(X_WARNING, "xf86OpenConsole: cannot open /dev/zero (%s)\n",
- strerror(errno));
- } else {
- if ((int)mmap(0, 0x1000, PROT_NONE,
- MAP_FIXED | MAP_SHARED, fd, 0) == -1) {
- xf86Msg(X_WARNING, "xf86OpenConsole: failed to protect page 0 (%s)\n",
- strerror(errno));
- }
- close(fd);
- }
- }
-
- /*
- * setup the virtual terminal manager
- */
- if (VTnum == -1) {
- /*
- * No device was specified. We need to query the kernel to see which
- * console device we are on (and in fact if we are on a console at all).
- */
- if (ioctl (0, VT_GETSTATE, &vts) < 0) {
- FatalError("xf86OpenConsole: Could not query active VT: %s\n",
- strerror(errno));
- }
- VTnum = vts.v_active;
- if (is_osr6())
- snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
- else
- snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
- } else {
- from = X_CMDLINE;
- if (is_osr6())
- snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
- else
- snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
- }
-
- if (IsConsoleDevice(vtdevice)) {
- isconsole = 1;
- CRTSpecified = FALSE; /* Dont honour -crt /dev/console */
- }
-
- if (ioctl (0, KIOCINFO, 0) >= 0)
- consdev = 1 + isconsole;
-
- if ((!CRTSpecified) && (isconsole || (!consdev))) {
- /*
- * Need to find a free VT
- */
- if ((fd = open ("/dev/console", O_WRONLY | O_NOCTTY)) < 0) {
- FatalError ("xf86OpenConsole: Could not open /dev/console: %s\n",
- strerror (errno));
- }
-
- if (ioctl (fd, VT_OPENQRY, &VTnum) < 0) {
- FatalError ("xf86OpenConsole: Cannot find a free VT: %s\n",
- strerror(errno));
- }
- close (fd);
- if (usl_is_osr6)
- snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
- else
- snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
- }
-
- /*
- * Now we can dispose of stdin/stdout
- */
- fclose (stdin);
- fclose (stdout);
-
- if (CRTSpecified || isconsole || consdev != 1) {
- if (!KeepTty) {
- setpgrp();
- }
- }
-
- if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NONBLOCK, 0)) < 0) {
- FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice,
- strerror(errno));
- }
-
- xf86Msg (from, "using VT number %d (%s)\n\n", VTnum, vtdevice);
- xf86Info.vtno = VTnum;
-
- /* change ownership of the vt */
- chown(vtdevice, getuid(), getgid());
-
- /*
- * now get the VT
- */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
- strerror(errno));
- }
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) {
- FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno));
- }
-
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
- FatalError("xf86OpenConsole: VT_GETMODE failed: %s\n", strerror(errno));
- }
-
- sigvtsw.sa_handler = xf86VTRequest;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
-
- ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
- if (ioctl_ret < 0) {
- FatalError("xf86OpenConsole: VT_SETMODE failed: %s\n", strerror(errno));
- }
-
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- FatalError("xf86OpenConsole: KD_GRAPHICS failed: %s\n", strerror(errno));
- }
- } else { /* serverGeneration != 1 */
- /*
- * now get the VT
- */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n", strerror(errno));
- }
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) {
- FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno));
- }
- /*
- * If the server doesn't have the VT when the reset occurs,
- * this is to make sure we don't continue until the activate
- * signal is received.
- */
- if (!xf86Screens[0]->vtSema)
- sleep(5);
- }
- return;
-}
-
-void
-xf86CloseConsole(void)
-{
- struct vt_mode VT;
- struct sigaction sigvtsw;
-
- ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
-
- sigvtsw.sa_handler = SIG_DFL;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
- VT.mode = VT_AUTO;
- VT.waitv = 0;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
- }
- close(xf86Info.consoleFd); /* make the vt-manager happy */
- return;
-}
-
-int
-xf86ProcessArgument(int argc, char *argv[], int i)
-{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals.
- */
- if (!strcmp(argv[i], "-keeptty")) {
- KeepTty = TRUE;
- return(1);
- }
-
- /*
- * Undocumented flag to protect page 0 from read/write to help
- * catch NULL pointer dereferences. This is purely a debugging
- * flag.
- */
- if (!strcmp(argv[i], "-protect0")) {
- Protect0 = TRUE;
- return(1);
- }
-
- if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
- UseMsg();
- VTnum = -1;
- return(0);
- }
- VTnum -= is_osr6();
- CRTSpecified = TRUE;
- return(1);
- }
-
- /*
- * Use a device the user specifies.
- */
- if (!strcmp(argv[i], "-crt")) {
- if (++i > argc) {
- UseMsg();
- VTnum = -1;
- return(0);
- } else {
- char *mytty = ttyname(0);
- char *arg = argv[i];
-
- if (!mytty)
- mytty = "\1";
- if (!arg[0])
- arg = "\2"; /* Prevent idiots from using -crt "" */
-
- if (strcmp (mytty, arg) != 0) {
- char *fmt;
-
- if (is_osr6())
- fmt = "/dev/tty%02d";
- else
- fmt = "/dev/vt%02d";
-
- if (sscanf(arg, fmt, &VTnum) == 0) {
- UseMsg();
- VTnum = -1;
- return(0);
- }
-
- /* OSR6 devices start names at 1, UW7 starts at 0 */
- VTnum -= is_osr6();
- CRTSpecified = TRUE;
- }
- return(2);
- }
- }
- return(0);
-}
-
-void
-xf86UseMsg(void)
-{
- if (is_osr6()) {
- ErrorF("-crt /dev/ttyXX use the specified VT device\n");
- ErrorF("vtXX use the specified VT number (01-16)\n");
- } else {
- ErrorF("-crt /dev/vtXX use the specified VT device\n");
- ErrorF("vtXX use the specified VT number (00-15)\n");
- }
-
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
- return;
-}
diff --git a/hw/xfree86/os-support/usl/usl_iop.c b/hw/xfree86/os-support/usl/usl_iop.c
deleted file mode 100644
index c6382fc7e..000000000
--- a/hw/xfree86/os-support/usl/usl_iop.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2001,2005 by Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include "X.h"
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-
-/***************************************************************************/
-/* I/O Permissions section */
-/***************************************************************************/
-
-static Bool IOEnabled = FALSE;
-
-_X_EXPORT Bool
-xf86EnableIO(void)
-{
- if (IOEnabled)
- return TRUE;
-
- if (sysi86(SI86IOPL, 3) < 0)
- FatalError("Failed to set IOPL for extended I/O\n");
- IOEnabled = TRUE;
- return TRUE;
-}
-
-_X_EXPORT void
-xf86DisableIO(void)
-{
- if (!IOEnabled)
- return;
-
- sysi86(SI86IOPL, 0);
- IOEnabled = FALSE;
-}
-
-/***************************************************************************/
-/* Interrupt Handling section */
-/***************************************************************************/
-
-_X_EXPORT Bool
-xf86DisableInterrupts(void)
-{
- if (!IOEnabled) {
- if (sysi86(SI86IOPL, 3) < 0)
- return FALSE;
- }
-
-#ifdef __GNUC__
- __asm__ __volatile__("cli");
-#else
- asm("cli");
-#endif /* __GNUC__ */
-
- if (!IOEnabled) {
- sysi86(SI86IOPL, 0);
- }
-
- return(TRUE);
-}
-
-_X_EXPORT void
-xf86EnableInterrupts(void)
-{
- if (!IOEnabled) {
- if (sysi86(SI86IOPL, 3) < 0)
- return;
- }
-
-#ifdef __GNUC__
- __asm__ __volatile__("sti");
-#else
- asm("sti");
-#endif /* __GNUC__ */
-
- if (!IOEnabled) {
- sysi86(SI86IOPL, 0);
- }
-}
-
diff --git a/hw/xfree86/os-support/usl/usl_video.c b/hw/xfree86/os-support/usl/usl_video.c
deleted file mode 100644
index 41abd2259..000000000
--- a/hw/xfree86/os-support/usl/usl_video.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyrught 2005 Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell, David Dawes
- * and Kean Johnston not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Thomas Roell, David Dawes and Kean Johnston make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
- * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- * THIS SOFTWARE.
- *
- */
-
-#include "X.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-static Bool
-linearVidMem(void)
-{
- return TRUE;
-}
-
-static pointer
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- pointer base;
- int fd;
-
- fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t)0, Size, (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_SHARED, fd, (off_t)Base);
- close(fd);
-
- if (base == MAP_FAILED) {
- FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
- "xf86MapVidMem", Size, Base, strerror(errno));
- }
- return(base);
-}
-
-/* ARGSUSED */
-static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
-{
- munmap(Base, Size);
-}
-
-/*
- * For some SVR4 versions, a 32-bit read is done for the first location
- * in each page when the page is first mapped. If this is done while
- * memory access is enabled for regions that have read side-effects,
- * this can cause unexpected results, including lockups on some hardware.
- * This function is called to make sure each page is mapped while it is
- * safe to do so.
- */
-
-#define X_PAGE_SIZE 4096
-
-static void
-readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
-{
- unsigned long base, end, addr;
- CARD32 val;
-
- base = (unsigned long)Base;
- end = base + Size;
-
- for (addr = base; addr < end; addr += X_PAGE_SIZE)
- val = *(volatile CARD32 *)addr;
-}
-
-void
-xf86OSInitVidMem(VidMemInfoPtr pVidMem)
-{
- pVidMem->linearSupported = linearVidMem();
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- pVidMem->readSideEffects = readSideEffects;
- pVidMem->initialised = TRUE;
-}
-
diff --git a/hw/xfree86/os-support/usl/usl_vtsw.c b/hw/xfree86/os-support/usl/usl_vtsw.c
deleted file mode 100644
index 812e5bddb..000000000
--- a/hw/xfree86/os-support/usl/usl_vtsw.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#include "X.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * Handle the VT-switching interface for SCO UnixWare / OpenServer 6
- */
-
-/*
- * This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer. NOTE: we do NOT need
- * to re-arm the signal here, since we used sigaction() to set the signal
- * disposition in usl_init.c. If we had used signal(), we would need to
- * re-arm the signal here. All we need to do now is record the fact that
- * we got the signal. XFree86 handles the rest.
- */
-void
-xf86VTRequest(int sig)
-{
- xf86Info.vtRequestsPending = TRUE;
- return;
-}
-
-Bool
-xf86VTSwitchPending(void)
-{
- return(xf86Info.vtRequestsPending ? TRUE : FALSE);
-}
-
-static int usl_ledstatus = -1;
-static unsigned int usl_ledstate = 0;
-
-Bool
-xf86VTSwitchAway(void)
-{
- usl_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &usl_ledstate);
-
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) {
- return(FALSE);
- } else {
- return(TRUE);
- }
-}
-
-Bool
-xf86VTSwitchTo(void)
-{
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
- return(FALSE);
- } else {
- if (usl_ledstatus >= 0) {
- ioctl (xf86Info.consoleFd, KDSETLED, usl_ledstate);
- }
- usl_ledstatus = -1;
-
- /*
- * Convince the console driver this screen is in graphics mode,
- * otherwise it assumes it can do more to the screen than it should.
- */
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
- }
-
- return TRUE;
- }
-}
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index a589461a0..b43c14df4 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -214,12 +214,6 @@
# define VT_SYSREQ_DEFAULT TRUE
# endif
-# ifdef SYSV
-# if !defined(ISC) || defined(ISC202) || defined(ISC22)
-# define NEED_STRERROR
-# endif
-# endif
-
#endif /* (SYSV || SVR4) && !DGUX */
@@ -578,15 +572,14 @@
# define MAXHOSTNAMELEN 32
#endif /* !MAXHOSTNAMELEN */
-#if !defined(X_NOT_POSIX)
-# if defined(_POSIX_SOURCE)
-# include <limits.h>
-# else
-# define _POSIX_SOURCE
-# include <limits.h>
-# undef _POSIX_SOURCE
-# endif /* _POSIX_SOURCE */
-#endif /* !X_NOT_POSIX */
+#if defined(_POSIX_SOURCE)
+# include <limits.h>
+#else
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+#endif /* _POSIX_SOURCE */
+
#if !defined(PATH_MAX)
# if defined(MAXPATHLEN)
# define PATH_MAX MAXPATHLEN
@@ -595,15 +588,6 @@
# endif /* MAXPATHLEN */
#endif /* !PATH_MAX */
-#ifdef NEED_STRERROR
-# ifndef strerror
-extern char *sys_errlist[];
-extern int sys_nerr;
-# define strerror(n) \
- ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
-# endif /* !strerror */
-#endif /* NEED_STRERROR */
-
#if defined(ISC)
#define rint(x) RInt(x)
double RInt(
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 849ee8bab..7f599f9c4 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -32,8 +32,7 @@ EXTRA_DIST = \
configProcs.h \
xf86Optrec.h \
xf86Parser.h \
- xf86tokens.h \
- cpconfig.c
+ xf86tokens.h
sdk_HEADERS = \
$(LIBHEADERS) \
diff --git a/hw/xfree86/parser/cpconfig.c b/hw/xfree86/parser/cpconfig.c
deleted file mode 100644
index 0347f7d2a..000000000
--- a/hw/xfree86/parser/cpconfig.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include "xf86Parser.h"
-#include "configProcs.h"
-
-#ifdef MALLOC_FUNCTIONS
-void
-xfree (void *p)
-{
- free (p);
- return;
-}
-
-void *
-xalloc (int size)
-{
- return malloc (size);
-}
-
-void *
-xrealloc (void *p, int size)
-{
- return realloc (p, size);
-}
-
-#endif
-
-#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \
- "%P/etc/X11/%F,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
- "%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X"
-
-int
-main (int argc, char *argv[])
-{
- const char *filename;
- char *cmdline = NULL;
- XF86ConfigPtr conf;
-
- if (argc > 1)
- {
- cmdline = argv[1];
- }
- if ((filename = xf86openConfigFile (CONFPATH, cmdline, NULL)))
- {
- fprintf (stderr, "Opened %s for the config file\n", filename);
- }
- else
- {
- fprintf (stderr, "Unable to open config file\n");
- exit (1);
- }
-
- if ((conf = xf86readConfigFile ()) == NULL)
- {
- fprintf (stderr, "Problem when parsing config file\n");
- }
- else
- {
- fprintf (stderr, "Config file parsed OK\n");
- }
- xf86closeConfigFile ();
-
- if (argc > 2) {
- fprintf(stderr, "Writing config file to `%s'\n", argv[2]);
- xf86writeConfigFile (argv[2], conf);
- }
- exit(0);
-}
-
-/* Functions that the parser requires */
-
-_X_EXPORT void
-VErrorF(const char *f, va_list args)
-{
- vfprintf(stderr, f, args);
-}
-
-_X_EXPORT void
-ErrorF(const char *f, ...)
-{
- va_list args;
-
- va_start(args, f);
- vfprintf(stderr, f, args);
- va_end(args);
-}
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 851b91161..0ed104d58 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -66,7 +66,6 @@
#include <stdarg.h>
#include <X11/Xfuncproto.h>
-#if !defined(X_NOT_POSIX)
#if defined(_POSIX_SOURCE)
#include <limits.h>
#else
@@ -74,7 +73,7 @@
#include <limits.h>
#undef _POSIX_SOURCE
#endif /* _POSIX_SOURCE */
-#endif /* !X_NOT_POSIX */
+
#if !defined(PATH_MAX)
#if defined(MAXPATHLEN)
#define PATH_MAX MAXPATHLEN
diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 6589fdc72..3b77b9314 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -68,15 +68,6 @@
#include <signal.h>
#include <errno.h>
-#if ((defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__)
-#ifndef strerror
-extern char *sys_errlist[];
-extern int sys_nerr;
-#define strerror(n) \
- (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
-#endif
-#endif
-
#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
#define HAS_SAVED_IDS_AND_SETEUID
#endif