summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/os-support')
-rw-r--r--hw/xfree86/os-support/bsd/alpha_video.c46
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.c4
-rw-r--r--hw/xfree86/os-support/bsd/bsd_mouse.c67
-rw-r--r--hw/xfree86/os-support/bus/Pci.c8
-rw-r--r--hw/xfree86/os-support/bus/zx1PCI.c99
5 files changed, 181 insertions, 43 deletions
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index aa3313dc3..655ac4a83 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.5 2003/04/03 16:50:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.6 2003/12/30 15:18:30 herrb Exp $ */
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
@@ -121,7 +121,7 @@ static struct alpha_bus_window *abw;
static int abw_count = -1;
static void
-init_abw()
+init_abw(void)
{
if (abw_count < 0) {
abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
@@ -142,7 +142,7 @@ has_bwx(void)
}
static unsigned long
-dense_base()
+dense_base(void)
{
if (abw_count < 0)
init_abw();
@@ -154,7 +154,7 @@ dense_base()
}
static unsigned long
-memory_base()
+memory_base(void)
{
if (abw_count < 0)
init_abw();
@@ -284,11 +284,13 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
pVidMem->mapMem = mapVidMemSparse;
pVidMem->unmapMem = unmapVidMemSparse;
+#ifndef __NetBSD__
if (axpSystem == -1)
axpSystem = bsdGetAXP();
hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
hae_mask = xf86AXPParams[axpSystem].hae_mask;
sparse_size = xf86AXPParams[axpSystem].size;
+#endif /* __NetBSD__ */
}
pVidMem->initialised = TRUE;
}
@@ -314,7 +316,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
if (base == MAP_FAILED)
{
- FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
"xf86MapVidMem", DEV_MEM, Size, Base,
strerror(errno));
}
@@ -324,7 +326,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
/* else, mmap /dev/vga */
if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
{
- FatalError("%s: Address 0x%x outside allowable range\n",
+ FatalError("%s: Address 0x%lx outside allowable range\n",
"xf86MapVidMem", Base);
}
base = mmap(0, Size,
@@ -372,7 +374,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
if ((long)ptr == -1)
{
xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
DEV_MEM, Len, Base, Offset, strerror(errno));
return(-1);
}
@@ -446,7 +448,9 @@ xf86EnableInterrupts()
#define vuip volatile unsigned int *
+#ifndef __NetBSD__
static unsigned long msb_set = 0;
+#endif
static pointer memSBase = 0;
static pointer memBase = 0;
@@ -490,6 +494,7 @@ struct parms {
u_int64_t hae;
};
+#ifndef __NetBSD__
static int
sethae(u_int64_t hae)
{
@@ -505,6 +510,7 @@ sethae(u_int64_t hae)
return -1;
#endif
}
+#endif /* __NetBSD__ */
static pointer
mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
@@ -552,11 +558,13 @@ static int
readSparse8(pointer Base, register unsigned long Offset)
{
register unsigned long result, shift;
+#ifndef __NetBSD__
register unsigned long msb;
-
+#endif
mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
shift = (Offset & 0x3) << 3;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
@@ -565,7 +573,7 @@ readSparse8(pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
-
+#endif
result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
result >>= shift;
return 0xffUL & result;
@@ -575,11 +583,14 @@ static int
readSparse16(pointer Base, register unsigned long Offset)
{
register unsigned long result, shift;
+#ifndef __NetBSD__
register unsigned long msb;
+#endif
mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
shift = (Offset & 0x2) << 3;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
@@ -588,6 +599,7 @@ readSparse16(pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
+#endif
result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2)));
result >>= shift;
return 0xffffUL & result;
@@ -603,11 +615,14 @@ readSparse32(pointer Base, register unsigned long Offset)
static void
writeSparse8(int Value, pointer Base, register unsigned long Offset)
{
+#ifndef __NetBSD__
register unsigned long msb;
+#endif
register unsigned int b = Value & 0xffU;
write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
@@ -616,17 +631,21 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
+#endif
*(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
}
static void
writeSparse16(int Value, pointer Base, register unsigned long Offset)
{
+#ifndef __NetBSD__
register unsigned long msb;
+#endif
register unsigned int w = Value & 0xffffU;
write_mem_barrier();
Offset += (unsigned long)Base - (unsigned long)memBase;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
@@ -635,6 +654,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
+#endif
*(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
w * 0x00010001;
@@ -651,10 +671,13 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset)
static void
writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
{
+#ifndef __NetBSD__
register unsigned long msb;
+#endif
register unsigned int b = Value & 0xffU;
Offset += (unsigned long)Base - (unsigned long)memBase;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
@@ -663,16 +686,20 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
+#endif
*(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
}
static void
writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
{
+#ifndef __NetBSD__
register unsigned long msb;
+#endif
register unsigned int w = Value & 0xffffU;
Offset += (unsigned long)Base - (unsigned long)memBase;
+#ifndef __NetBSD__
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask ;
Offset -= msb;
@@ -681,6 +708,7 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
msb_set = msb;
}
}
+#endif
*(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
w * 0x00010001;
}
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c
index 0d586ef72..3c22eeb4d 100644
--- a/hw/xfree86/os-support/bsd/bsd_kbd.c
+++ b/hw/xfree86/os-support/bsd/bsd_kbd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.8 2003/11/04 03:16:58 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.9 2004/01/07 17:05:28 tsi Exp $ */
/*
* Copyright (c) 2002 by The XFree86 Project, Inc.
@@ -497,7 +497,7 @@ OpenKeyboard(InputInfoPtr pInfo)
#endif
default:
xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"",
- pKbd->wsKbdType, pInfo->name);
+ pInfo->name, pKbd->wsKbdType);
close(pInfo->fd);
return FALSE;
}
diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c
index 943bb9855..ac878a9e1 100644
--- a/hw/xfree86/os-support/bsd/bsd_mouse.c
+++ b/hw/xfree86/os-support/bsd/bsd_mouse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.26 2003/10/10 20:56:05 herrb Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.27 2004/01/17 15:20:05 herrb Exp $ */
/*
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
@@ -80,6 +80,16 @@ static const char *mouseDevs[] = {
DEFAULT_PS2_DEV,
NULL
};
+#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
+/* Only wsmouse mices are autoconfigured for now on OpenBSD */
+#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse"
+#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0"
+
+static const char *mouseDevs[] = {
+ DEFAULT_WSMOUSE_DEV,
+ DEFAULT_WSMOUSE0_DEV,
+ NULL
+};
#endif
static int
@@ -141,6 +151,8 @@ DefaultProtocol(void)
{
#if defined(__FreeBSD__)
return "Auto";
+#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
+ return "WSMouse";
#else
return NULL;
#endif
@@ -195,7 +207,7 @@ SetupAuto(InputInfoPtr pInfo, int *protoPara)
protoPara[0] = mode.syncmask[0];
protoPara[1] = mode.syncmask[1];
}
- xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
pInfo->name, devproto[i].name);
return devproto[i].name;
}
@@ -325,7 +337,50 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
}
#endif
-#if defined(WSCONS_SUPPORT)
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
+
+/* Only support wsmouse configuration for now */
+static const char *
+SetupAuto(InputInfoPtr pInfo, int *protoPara)
+{
+
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
+ pInfo->name, "wsmouse");
+ return "wsmouse";
+}
+
+static void
+SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
+{
+
+ xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n",
+ pInfo->name, protocol, rate, res);
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd != -1) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions,
+ "Device", *pdev);
+ xf86Msg(X_INFO, "%s: found Device \"%s\"\n",
+ pInfo->name, *pdev);
+ close(fd);
+ break;
+ }
+ }
+ return *pdev;
+}
+#endif (__OpenBSD__)
+
+#ifdef WSCONS_SUPPORT
#define NUMEVENTS 64
static void
@@ -718,7 +773,11 @@ xf86OSMouseInit(int flags)
p->SetBMRes = SetSysMouseRes;
p->SetMiscRes = SetSysMouseRes;
#endif
-#if defined(__FreeBSD__)
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
+ p->SetupAuto = SetupAuto;
+ p->SetMiscRes = SetMouseRes;
+#endif
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
p->FindDevice = FindDevice;
#endif
p->PreInit = bsdMousePreInit;
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index a0b639143..ab10485ee 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.81 2003/09/24 02:43:34 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.82 2004/01/16 15:39:04 tsi Exp $ */
/*
* Pci.c - New server PCI access functions
*
@@ -1016,7 +1016,9 @@ xf86scanpci(int flags)
if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN))
break;
pciWriteByte(tag, PCI_PCI_BRIDGE_CONTROL_REG,
- devp->pci_bridge_control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN);
+ devp->pci_bridge_control &
+ ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN |
+ PCI_PCI_BRIDGE_SECONDARY_RESET));
break;
default:
@@ -1079,7 +1081,7 @@ xf86scanpci(int flags)
if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN))
break;
pciWriteByte(devp->tag, PCI_PCI_BRIDGE_CONTROL_REG,
- devp->pci_bridge_control);
+ devp->pci_bridge_control & ~PCI_PCI_BRIDGE_SECONDARY_RESET);
break;
default:
diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c
index ee92263fa..5d4d6a991 100644
--- a/hw/xfree86/os-support/bus/zx1PCI.c
+++ b/hw/xfree86/os-support/bus/zx1PCI.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.6 2003/12/11 17:11:39 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.8 2004/01/16 15:39:38 tsi Exp $ */
/*
* Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
*
@@ -97,9 +97,10 @@
#define LBA_PORT5_CNTRL 0x1228U
#define LBA_PORT6_CNTRL 0x1230U
#define LBA_PORT7_CNTRL 0x1238U
-#define LBA_ROPE_RESET 0x01UL
-#define LBA_CLEAR_ERROR 0x10UL
-#define LBA_HARD_FAIL 0x40UL
+#define LBA_RESET_FUNCTION 0x0000000001UL
+#define LBA_CLEAR_ERROR 0x0000000010UL
+#define LBA_HARD_FAIL 0x0000000040UL
+#define LBA_RESET_COMPLETE 0x0100000000UL
#define ROPE_PAGE_CONTROL 0x1418U
@@ -117,8 +118,11 @@
#define IOA_SUBORDINATE_BUS 0x0059U
#define IOA_CONTROL 0x0108U
-#define IOA_FORWARD_VGA 0x08UL
-#define IOA_HARD_FAIL 0x40UL
+#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
@@ -134,12 +138,33 @@
#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)
@@ -156,10 +181,15 @@
static CARD8 *pZX1mio = NULL,
*pZX1ioa = NULL;
-static INT8 zx1_ropemap[8]; /* One for each (potential) rope */
-static CARD64 zx1_lbacntl[8]; /* " " " " " */
+/* 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;
@@ -292,7 +322,8 @@ ControlZX1Bridge(int bus, CARD16 mask, CARD16 value)
* SLAVE_CONTROL register.
*/
tmp1 = MIO_QUAD(VGA_ROUTE);
- tmp2 = IOA_QUAD(ropenum, IOA_CONTROL);
+ 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) &&
@@ -315,8 +346,9 @@ ControlZX1Bridge(int bus, CARD16 mask, CARD16 value)
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_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;
@@ -329,7 +361,7 @@ ControlZX1Bridge(int bus, CARD16 mask, CARD16 value)
/* Move on to master abort failure enablement */
tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) &
- ~(LBA_ROPE_RESET | LBA_CLEAR_ERROR);
+ ~(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) &&
@@ -520,14 +552,14 @@ xf86PreScanZX1(void)
/* Prevent hard-fails */
zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) &
- ~(LBA_ROPE_RESET | LBA_CLEAR_ERROR);
+ ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR);
if (zx1_lbacntl[i] & LBA_HARD_FAIL)
MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) =
zx1_lbacntl[i] & ~LBA_HARD_FAIL;
/* Poke for an ioa */
- tmp = IOA_LONG(i, PCI_ID_REG);
- switch ((CARD32)tmp) {
+ 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 */
@@ -539,10 +571,10 @@ xf86PreScanZX1(void)
break;
default:
- if ((CARD16)(tmp + 1U) > (CARD16)1U)
+ if ((CARD16)(zx1_pciids[i] + 1U) > (CARD16)1U)
xf86MsgVerb(X_NOTICE, 0,
"HP ZX1: Unexpected vendor/device id 0x%08X"
- " on rope %d\n", (CARD32)tmp, i);
+ " on rope %d\n", zx1_pciids[i], i);
/* Nobody home, or not the "right" kind of rope guest */
/*
@@ -906,6 +938,9 @@ xf86PostScanZX1(void)
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.
@@ -929,6 +964,8 @@ xf86PostScanZX1(void)
*ppPCI++ = pPCI;
idx++;
+ zx1_busnmpt[pPCI->busnum] = TRUE;
+
if (zx1_hasvga)
continue;
@@ -953,8 +990,8 @@ xf86PostScanZX1(void)
}
/*
- * Restore hard-fail settings and figure out the actual subordinate bus
- * numbers.
+ * 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)
@@ -968,6 +1005,14 @@ xf86PostScanZX1(void)
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) {
@@ -977,13 +1022,13 @@ xf86PostScanZX1(void)
}
/* Set up our extra bus functions */
- zx1BusFuncs = *(pciBusInfo[0]->funcs);
+ zx1BusFuncs = *(pBusInfo->funcs);
zx1BusFuncs.pciControlBridge = ControlZX1Bridge;
zx1BusFuncs.pciGetBridgeResources = GetZX1BridgeResources;
/* Set up our own fake bus to act as the root segment */
- zx1FakeBus.configMech = pciBusInfo[0]->configMech;
- zx1FakeBus.numDevices = pciBusInfo[0]->numDevices;
+ zx1FakeBus.configMech = pBusInfo->configMech;
+ zx1FakeBus.numDevices = pBusInfo->numDevices;
zx1FakeBus.primary_bus = zx1_fakebus;
pciBusInfo[zx1_fakebus] = &zx1FakeBus;
@@ -1018,7 +1063,8 @@ xf86PostScanZX1(void)
/* Add a fake PCI-to-PCI bridge to represent each active rope */
for (i = 0; i < 8; i++) {
- if ((zx1_ropemap[i] != i) || !(pBusInfo = pciBusInfo[zx1_busno[i]]))
+ if ((zx1_ropemap[i] != i) || (zx1_busno[i] > zx1_subno[i]) ||
+ !(pBusInfo = pciBusInfo[zx1_busno[i]]))
continue;
if (++idx >= MAX_PCI_DEVICES)
@@ -1028,7 +1074,7 @@ xf86PostScanZX1(void)
pPCI->devnum = i | 0x10;
/* pPCI->funcnum = 0; */
pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0);
- pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_LBA);
+ 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;
@@ -1044,6 +1090,9 @@ xf86PostScanZX1(void)
/* 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",