Hello community,
here is the log from the commit of package xorg-x11-server
checked in at Mon Aug 21 11:40:47 CEST 2006.
--------
--- xorg-x11-server/xorg-x11-server.changes 2006-08-17 22:03:11.000000000 +0200
+++ xorg-x11-server/xorg-x11-server.changes 2006-08-20 15:04:16.000000000 +0200
@@ -1,0 +2,17 @@
+Sun Aug 20 11:36:57 CEST 2006 - sndirsch@suse.de
+
+- added PCI/IA64 patches, but disabled them for now (Bug #197572)
+- remove comp. symlinks in /usr/X11R6/bin for openSUSE >= 10.2
+
+-------------------------------------------------------------------
+Fri Aug 18 13:05:07 CEST 2006 - sndirsch@suse.de
+
+- fixed build for s390/s390x, e.g. use configure options
+ --disable-install-libxf86config
+ --disable-aiglx
+ --disable-dri
+ --disable-xorg
+- changed os-name to "openSUSE" instead of "Linux" before
+- fake release version for fglrx driver :-(
+
+-------------------------------------------------------------------
New:
----
p_mappciBIOS_complete.diff
p_pci-ce-x.diff
p_pci-domain.diff
p_pci-ia64.diff
p_pci-legacy-mmap.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xorg-x11-server.spec ++++++
--- /var/tmp/diff_new_pack.vgluTZ/_old 2006-08-21 11:40:04.000000000 +0200
+++ /var/tmp/diff_new_pack.vgluTZ/_new 2006-08-21 11:40:04.000000000 +0200
@@ -12,12 +12,12 @@
Name: xorg-x11-server
%define dirsuffix 1.1.99.3
-#!BuildIgnore: xorg-x11-Mesa xorg-x11-Mesa-devel
+%define fglrx_driver_hack 1
BuildRequires: Mesa-devel cpp fontconfig-devel freetype2-devel ghostscript-library glitz-devel libdrm-devel pkgconfig xorg-x11 xorg-x11-devel xorg-x11-libICE-devel xorg-x11-libSM-devel xorg-x11-libX11-devel xorg-x11-libXau-devel xorg-x11-libXdmcp-devel xorg-x11-libXext-devel xorg-x11-libXfixes-devel xorg-x11-libXmu-devel xorg-x11-libXp-devel xorg-x11-libXpm-devel xorg-x11-libXprintUtil-devel xorg-x11-libXrender-devel xorg-x11-libXt-devel xorg-x11-libXv-devel xorg-x11-libfontenc-devel xorg-x11-libxkbfile-devel xorg-x11-proto-devel xorg-x11-xtrans-devel
URL: http://xorg.freedesktop.org/
%define EXPERIMENTAL 0
Version: 7.1
-Release: 19
+Release: 20
License: X11/MIT
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: System/X11/Servers/XF86_4
@@ -50,7 +50,11 @@
Patch18: p_ia64-console.diff
Patch19: disable-aiglx.diff
Patch20: xinerama-sig11.diff
-
+Patch334: p_pci-domain.diff
+Patch350: p_pci-ia64.diff
+Patch357: p_pci-ce-x.diff
+Patch359: p_mappciBIOS_complete.diff
+Patch364: p_pci-legacy-mmap.diff
%description
This package contains the X.Org Server.
@@ -106,6 +110,7 @@
Ronny Vindenes
Jim Gettys
+%ifnarch s390 s390x
%package sdk
Summary: X.Org Server SDK.
Group: System/Libraries
@@ -168,6 +173,7 @@
Ronny Vindenes
Jim Gettys
+%endif
%prep
%setup -n xorg-server-%{dirsuffix} -b1 -a4
%patch
@@ -195,31 +201,62 @@
popd
%patch19
%patch20 -p1
+### Bug 197572: X.Org PCI patches stilll left
+#%patch334 -p2 -b .p_pci-domain.diff
+#pushd hw/xfree86/os-support/bus
+#%patch350 -p0 -b .p_pci-ia64.diff
+#popd
+#%patch357 -p4 -b .p_pci-ce-x.diff
+#%patch359 -p2 -b .p_mappciBIOS_complete.diff
+#%ifarch ia64
+#%patch364 -p4 -b .p_pci-legacy-mmap.diff
+#%endif
%build
autoreconf -fi
./configure CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
+%if %fglrx_driver_hack
+ --with-release-major=7 \
+ --with-release-minor=1 \
+ --with-release-patch=0 \
+ --with-release-snap=0 \
+ --with-release-date="%(date)" \
+ --with-release-version=7.1.0.0 \
+%endif
--prefix=/usr \
--libdir=%{_libdir} \
--mandir=%{_mandir} \
--enable-builddocs \
+%ifarch s390 s390x
+ --disable-install-libxf86config \
+%else
--enable-install-libxf86config \
+%endif
%ifarch %EXPERIMENTAL
--enable-glx-tls \
--enable-multibuffer \
%endif
+%ifarch s390 s390x
+ --disable-aiglx \
+%else
--enable-aiglx \
+%endif
--enable-lbx \
--enable-xdmcp \
--enable-xdm-auth-1 \
+%ifarch s390 s390x
+ --disable-dri \
+ --disable-xorg \
+%else
--enable-dri \
--enable-xorg \
+%endif
--enable-dmx \
--enable-xnest \
--enable-xprint \
--disable-kbd_mode \
--with-log-dir="/var/log" \
- --with-os-name="Linux" \
+ --with-os-name="openSUSE" \
--with-os-vendor="SUSE LINUX" \
--with-mesa-source=$RPM_BUILD_DIR/Mesa \
--with-fontdir="/usr/share/fonts" \
@@ -229,12 +266,15 @@
%install
make install DESTDIR=$RPM_BUILD_ROOT
+%ifnarch s390 s390x
install -m 644 hw/xfree86/parser/{xf86Parser.h,xf86Optrec.h} \
$RPM_BUILD_ROOT/usr/include/
-# add compatibility symlinks
+# add compatibility symlinks for SUSE <= 10.1
+%if %suse_version <= 1010
mkdir -p $RPM_BUILD_ROOT/usr/X11R6/bin
ln -snf ../../bin/X $RPM_BUILD_ROOT/usr/X11R6/bin/X
ln -snf ../../bin/Xorg $RPM_BUILD_ROOT/usr/X11R6/bin/Xorg
+%endif
chmod u+s $RPM_BUILD_ROOT/usr/bin/Xorg
mkdir -p $RPM_BUILD_ROOT/var/X11R6/bin
ln -snf ../../../usr/bin/Xorg $RPM_BUILD_ROOT/var/X11R6/bin/X
@@ -251,12 +291,17 @@
cat > $RPM_BUILD_ROOT/etc/permissions.d/xorg-x11-server.easy << EOF
/usr/bin/Xorg root:root 0711
EOF
+%else
+rm -f $RPM_BUILD_ROOT/usr/share/aclocal/*.m4
+%endif
%clean
rm -rf "$RPM_BUILD_ROOT"
+%ifnarch s390 s390x
%verifyscript
%verify_permissions -e /usr/bin/Xorg
+%endif
%pre
test -L usr/lib/X11 && rm usr/lib/X11
@@ -264,6 +309,7 @@
exit 0
%post
+%ifnarch s390 s390x
%run_permissions
rm -f var/log/XFree86.*.log*
# SaX2 writes xorg.conf since SuSE 9.3
@@ -339,6 +385,7 @@
etc/X11/xorg.conf
fi
fi
+%endif
# Installation of init script seems to be disabled by default
# Create symbolic run level links for xprint start script
if false; then
@@ -360,27 +407,39 @@
%{insserv_cleanup}
fi
exit 0
+%ifnarch s390 s390x
%pre sdk
test -L usr/include/X11 && rm usr/include/X11
exit 0
+%endif
%files
%defattr(-,root,root)
+%ifnarch s390 s390x
%dir /usr/%{_lib}/xorg
%dir /var/X11R6/bin
+%endif
%dir /var/lib/xkb
%dir /var/lib/xkb/compiled
+%ifnarch s390 s390x
/etc/permissions.d/%name.*
+%if %suse_version <= 1010
/usr/X11R6/bin/X
/usr/X11R6/bin/Xorg
+%endif
/usr/bin/X
+%endif
/usr/bin/Xdmx
/usr/bin/Xnest
+%ifnarch s390 s390x
%verify(not mode) /usr/bin/Xorg
+%endif
/usr/bin/Xprt
/usr/bin/Xvfb
+%ifnarch s390 s390x
/usr/bin/cvt
+%endif
/usr/bin/dmxaddinput
/usr/bin/dmxaddscreen
/usr/bin/dmxreconfig
@@ -389,6 +448,7 @@
/usr/bin/dmxrmscreen
/usr/bin/dmxtodmx
/usr/bin/dmxwininfo
+%ifnarch s390 s390x
/usr/bin/gtf
/usr/bin/inb
/usr/bin/inl
@@ -399,24 +459,34 @@
/usr/bin/outw
/usr/bin/pcitweak
/usr/bin/scanpci
+%endif
/usr/bin/vdltodmx
/usr/bin/xdmx
/usr/bin/xdmxconfig
+%ifnarch s390 s390x
/usr/bin/xorgcfg
/usr/bin/xorgconfig
/usr/include/X11/bitmaps/
/usr/include/X11/pixmaps/
+%endif
/usr/%{_lib}/X11/*
/usr/%{_lib}/pkgconfig/*.pc
+%ifnarch s390 s390x
/usr/%{_lib}/xorg/modules/
/usr/%{_lib}/xorg/modules/updates/
+%endif
/usr/%{_lib}/xserver/
+%ifnarch s390 s390x
/usr/share/X11/
+%endif
%{_mandir}/man1/*
+%ifnarch s390 s390x
%{_mandir}/man4/*
%{_mandir}/man5/*
/var/X11R6/bin/X
+%endif
/var/lib/xkb/compiled/README.compiled
+%ifnarch s390 s390x
%files sdk
%defattr(-,root,root)
@@ -425,8 +495,20 @@
/usr/include/xorg/
/usr/%{_lib}/*.a
/usr/share/aclocal/*.m4
+%endif
%changelog -n xorg-x11-server
+* Sun Aug 20 2006 - sndirsch@suse.de
+- added PCI/IA64 patches, but disabled them for now (Bug #197572)
+- remove comp. symlinks in /usr/X11R6/bin for openSUSE >= 10.2
+* Fri Aug 18 2006 - sndirsch@suse.de
+- fixed build for s390/s390x, e.g. use configure options
+--disable-install-libxf86config
+--disable-aiglx
+--disable-dri
+--disable-xorg
+- changed os-name to "openSUSE" instead of "Linux" before
+- fake release version for fglrx driver :-(
* Thu Aug 17 2006 - sndirsch@suse.de
- xinerama-sig11.diff:
* prevents Xserver Sig11 with broken Xinerama config (Bug #135002)
++++++ p_mappciBIOS_complete.diff ++++++
Index: programs/Xserver/hw/xfree86/common/xf86Priv.h
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v
retrieving revision 1.1.1.26
diff -u -p -r1.1.1.26 xf86Priv.h
--- programs/Xserver/hw/xfree86/common/xf86Priv.h 23 Jan 2006 11:15:21 -0000 1.1.1.26
+++ programs/Xserver/hw/xfree86/common/xf86Priv.h 9 Mar 2006 11:20:37 -0000
@@ -155,6 +155,7 @@ void xf86AddDevToEntity(int entityIndex,
extern void xf86PostPreInit(void);
extern void xf86PostScreenInit(void);
extern memType getValidBIOSBase(PCITAG tag, int num);
+extern memType getEmptyPciRange(PCITAG tag, int base_reg);
extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag);
/* xf86Config.c */
Index: programs/Xserver/hw/xfree86/common/xf86pciBus.c
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v
retrieving revision 1.1.1.57
diff -u -p -r1.1.1.57 xf86pciBus.c
--- programs/Xserver/hw/xfree86/common/xf86pciBus.c 13 Sep 2005 10:31:26 -0000 1.1.1.57
+++ programs/Xserver/hw/xfree86/common/xf86pciBus.c 9 Mar 2006 11:20:37 -0000
@@ -1516,29 +1516,117 @@ xf86ReallocatePciResources(int entityInd
/*
* BIOS releated
*/
-memType
-getValidBIOSBase(PCITAG tag, int num)
+static resPtr
+getOwnResources(pciVideoPtr pvp, resPtr mem)
+{
+ resRange range;
+ int i;
+ /* Make sure we don't conflict with our own mem resources */
+ for (i = 0; i < 6; i++) {
+ if (!pvp->memBase[i])
+ continue;
+ P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],
+ ResExcMemBlock);
+ mem = xf86AddResToList(mem,&range,-1);
+ }
+ return mem;
+}
+
+static void
+getPciRangesForMapping(pciVideoPtr pvp, resPtr *map, resPtr *avoid)
{
- pciVideoPtr pvp = NULL;
PciBusPtr pbp;
- resPtr m = NULL;
- resPtr tmp, avoid, mem = NULL;
+ resPtr tmp;
+
+ *avoid = xf86DupResList(pciAvoidRes);
+
+ pbp = xf86PciBus;
+ while (pbp) {
+ if (pbp->secondary == pvp->bus) {
+ if (pbp->preferred_pmem)
+ tmp = xf86DupResList(pbp->preferred_pmem);
+ else
+ tmp = xf86DupResList(pbp->pmem);
+ *map = xf86JoinResLists(*map,tmp);
+ if (pbp->preferred_mem)
+ tmp = xf86DupResList(pbp->preferred_mem);
+ else
+ tmp = xf86DupResList(pbp->mem);
+ *map = xf86JoinResLists(*map,tmp);
+ tmp = *map;
+ while (tmp) {
+ tmp->block_end = min(tmp->block_end,PCI_MEM32_LENGTH_MAX);
+ tmp = tmp->next;
+ }
+ } else if ((pbp->primary == pvp->bus) &&
+ (pbp->secondary >= 0) &&
+ (pbp->primary != pbp->secondary)) {
+ tmp = xf86DupResList(pbp->preferred_pmem);
+ *avoid = xf86JoinResLists(*avoid, tmp);
+ tmp = xf86DupResList(pbp->pmem);
+ *avoid = xf86JoinResLists(*avoid, tmp);
+ tmp = xf86DupResList(pbp->preferred_mem);
+ *avoid = xf86JoinResLists(*avoid, tmp);
+ tmp = xf86DupResList(pbp->mem);
+ *avoid = xf86JoinResLists(*avoid, tmp);
+ }
+ pbp = pbp->next;
+ }
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, *avoid);
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, *map);
+}
+
+static memType
+findPciRange(PCITAG tag, resPtr m, resPtr avoid, CARD32 size)
+{
resRange range;
- memType ret;
+ CARD32 alignment = (1 << size) - 1;
+
+ while (m) {
+ range = xf86GetBlock(RANGE_TYPE(ResExcMemBlock, xf86GetPciDomain(tag)),
+ PCI_SIZE(ResMem, tag, 1 << size),
+ m->block_begin, m->block_end,
+ PCI_SIZE(ResMem, tag, alignment),
+ avoid);
+ if (range.type != ResEnd) {
+ return M2B(tag, range.rBase);
+ }
+ m = m->next;
+ }
+ return 0;
+}
+
+pciVideoPtr
+getPciVideoPtr(tag)
+{
int n = 0;
- int i;
- CARD32 biosSize, alignment;
+ pciVideoPtr pvp = NULL;
if (!xf86PciVideoInfo) return 0;
while ((pvp = xf86PciVideoInfo[n++])) {
if (pciTag(pvp->bus,pvp->device,pvp->func) == tag)
- break;
+ return pvp;
}
+ return NULL;
+}
+
+memType
+getValidBIOSBase(PCITAG tag, int num)
+{
+ pciVideoPtr pvp = NULL;
+ memType ret;
+ CARD32 biosSize;
+ resPtr mem = NULL;
+ resPtr avoid = NULL, m = NULL;
+ resRange range;
+
+ pvp = getPciVideoPtr(tag);
+
if (!pvp) return 0;
biosSize = pvp->biosSize;
- alignment = (1 << biosSize) - 1;
+
if (biosSize > 24)
biosSize = 24;
@@ -1549,15 +1637,8 @@ getValidBIOSBase(PCITAG tag, int num)
/* In some cases the BIOS base register contains the size mask */
if ((memType)(-1 << biosSize) == PCIGETROM(pvp->biosBase))
return 0;
- /* Make sure we don't conflict with our own mem resources */
- for (i = 0; i < 6; i++) {
- if (!pvp->memBase[i])
- continue;
- P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],
- ResExcMemBlock);
- mem = xf86AddResToList(mem,&range,-1);
- }
- P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock);
+ mem = getOwnResources(pvp,mem);
+ P_M_RANGE(range, tag, pvp->biosBase,biosSize,ResExcMemBlock);
ret = pvp->biosBase;
break;
case ROM_BASE_MEM0:
@@ -1568,7 +1649,7 @@ getValidBIOSBase(PCITAG tag, int num)
case ROM_BASE_MEM5:
if (!pvp->memBase[num] || (pvp->size[num] < biosSize))
return 0;
- P_M_RANGE(range, TAG(pvp),pvp->memBase[num],biosSize,
+ P_M_RANGE(range, tag ,pvp->memBase[num],biosSize,
ResExcMemBlock);
ret = pvp->memBase[num];
break;
@@ -1580,59 +1661,15 @@ getValidBIOSBase(PCITAG tag, int num)
}
/* Now find the ranges for validation */
- avoid = xf86DupResList(pciAvoidRes);
- pbp = xf86PciBus;
- while (pbp) {
- if (pbp->secondary == pvp->bus) {
- if (pbp->preferred_pmem)
- tmp = xf86DupResList(pbp->preferred_pmem);
- else
- tmp = xf86DupResList(pbp->pmem);
- m = xf86JoinResLists(m,tmp);
- if (pbp->preferred_mem)
- tmp = xf86DupResList(pbp->preferred_mem);
- else
- tmp = xf86DupResList(pbp->mem);
- m = xf86JoinResLists(m,tmp);
- tmp = m;
- while (tmp) {
- tmp->block_end = min(tmp->block_end,PCI_MEM32_LENGTH_MAX);
- tmp = tmp->next;
- }
- } else if ((pbp->primary == pvp->bus) &&
- (pbp->secondary >= 0) &&
- (pbp->primary != pbp->secondary)) {
- tmp = xf86DupResList(pbp->preferred_pmem);
- avoid = xf86JoinResLists(avoid, tmp);
- tmp = xf86DupResList(pbp->pmem);
- avoid = xf86JoinResLists(avoid, tmp);
- tmp = xf86DupResList(pbp->preferred_mem);
- avoid = xf86JoinResLists(avoid, tmp);
- tmp = xf86DupResList(pbp->mem);
- avoid = xf86JoinResLists(avoid, tmp);
- }
- pbp = pbp->next;
- }
- pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid);
- if (mem)
- pciConvertListToHost(pvp->bus,pvp->device,pvp->func, mem);
-
+ getPciRangesForMapping(pvp,&m,&avoid);
+
if (!ret) {
/* Return a possible window */
- while (m) {
- range = xf86GetBlock(RANGE_TYPE(ResExcMemBlock, xf86GetPciDomain(tag)),
- PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize),
- m->block_begin, m->block_end,
- PCI_SIZE(ResMem, TAG(pvp), alignment),
- avoid);
- if (range.type != ResEnd) {
- ret = M2B(TAG(pvp), range.rBase);
- break;
- }
- m = m->next;
- }
+ ret = findPciRange(tag,m,avoid,biosSize);
} else {
#if !defined(__ia64__) /* on ia64, trust the kernel, don't look for overlaps */
+ if (mem)
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, mem);
if (!xf86IsSubsetOf(range, m) ||
ChkConflict(&range, avoid, SETUP)
|| (mem && ChkConflict(&range, mem, SETUP)))
@@ -1645,6 +1682,22 @@ getValidBIOSBase(PCITAG tag, int num)
return ret;
}
+memType
+getEmptyPciRange(PCITAG tag, int base_reg)
+{
+ resPtr avoid = NULL, m = NULL;
+ memType ret;
+
+ pciVideoPtr pvp = getPciVideoPtr(tag);
+ if (!pvp) return 0;
+ getPciRangesForMapping(pvp,&m,&avoid);
+ ret = findPciRange(tag,m,avoid,pvp->size[base_reg]);
+ xf86FreeResList(avoid);
+ xf86FreeResList(m);
+
+ return ret;
+}
+
/*
* xf86Bus.c interface
*/
Index: programs/Xserver/hw/xfree86/dummylib/Imakefile
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/dummylib/Imakefile,v
retrieving revision 1.1.1.8
diff -u -p -r1.1.1.8 Imakefile
--- programs/Xserver/hw/xfree86/dummylib/Imakefile 13 Sep 2005 10:31:34 -0000 1.1.1.8
+++ programs/Xserver/hw/xfree86/dummylib/Imakefile 9 Mar 2006 11:20:38 -0000
@@ -8,6 +8,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86O
SRCS = \
fatalerror.c \
getvalidbios.c \
+ getemptypci.c \
logvwrite.c \
pcitestmulti.c \
verrorf.c \
@@ -32,6 +33,7 @@ SRCS = \
OBJS = \
fatalerror.o \
getvalidbios.o \
+ getemptypci.o \
logvwrite.o \
pcitestmulti.o \
verrorf.o \
Index: programs/Xserver/hw/xfree86/dummylib/getemptypci.c
===================================================================
RCS file: programs/Xserver/hw/xfree86/dummylib/getemptypci.c
diff -N programs/Xserver/hw/xfree86/dummylib/getemptypci.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ programs/Xserver/hw/xfree86/dummylib/getemptypci.c 9 Mar 2006 11:20:38 -0000
@@ -0,0 +1,19 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include
+#endif
+
+#include
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+memType
+getEmptyPciRange(PCITAG tag, int base_reg)
+{
+ return 0;
+}
Index: programs/Xserver/hw/xfree86/os-support/bus/Pci.c
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v
retrieving revision 1.1.1.60
diff -u -p -r1.1.1.60 Pci.c
--- programs/Xserver/hw/xfree86/os-support/bus/Pci.c 25 Nov 2005 10:05:28 -0000 1.1.1.60
+++ programs/Xserver/hw/xfree86/os-support/bus/Pci.c 9 Mar 2006 11:20:40 -0000
@@ -1068,6 +1068,20 @@ xf86scanpci(int flags)
return pci_devp;
}
+pciConfigPtr
+xf86GetPciConfigFromTag(PCITAG Tag)
+{
+ pciConfigPtr pDev;
+ int i = 0;
+
+ for (i = 0 ; (pDev = pci_devp[i]) && i <= MAX_PCI_DEVICES; i++) {
+ if (Tag == pDev->tag)
+ return pDev;
+ }
+
+ return NULL; /* Bad data */
+}
+
CARD32
pciCheckForBrokenBase(PCITAG Tag,int basereg)
{
@@ -1160,13 +1174,18 @@ handlePciBIOS(PCITAG Tag, int basereg,
/* if we use a mem base save it and move it out of the way */
if (b_reg >= 0 && b_reg <= 5) {
+ memType emptybase;
savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2));
xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
" for device %i:%i:%i\n", basereg,
(int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag),
(int)PCI_FUNC_FROM_TAG(Tag));
+ if (!(emptybase = getEmptyPciRange(Tag,b_reg))) {
+ xf86Msg(X_ERROR,"Cannot find empty range to map base to\n");
+ return 0;
+ }
pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2),
- (CARD32)~0);
+ emptybase);
}
/* Set ROM base address and enable ROM address decoding */
pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr
Index: programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v
retrieving revision 1.1.1.33
diff -u -p -r1.1.1.33 xf86Pci.h
--- programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h 27 Apr 2005 16:00:07 -0000 1.1.1.33
+++ programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h 9 Mar 2006 11:20:40 -0000
@@ -780,6 +780,7 @@ int xf86ReadPciBIOSByType(unsigned
int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg,
PciBiosType *Buf);
pciConfigPtr *xf86scanpci(int flags);
+pciConfigPtr xf86GetPciConfigFromTag(PCITAG Tag);
extern int pciNumBuses;
Index: programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v
retrieving revision 1.1.1.10
diff -u -p -r1.1.1.10 lnx_pci.c
--- programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c 25 Nov 2005 10:05:30 -0000 1.1.1.10
+++ programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c 9 Mar 2006 11:20:40 -0000
@@ -201,6 +201,8 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int s
fn = devfn & 0x7;
if (tag == pciTag(bus,dev,fn)) {
/* ok now look through all the BAR values of this device */
+ pciConfigPtr pDev = xf86GetPciConfigFromTag(tag);
+
for (ndx=0; ndx<7; ndx++) {
unsigned long savePtr;
/*
@@ -208,11 +210,9 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int s
* memory attributes
*/
if (ndx == 6)
- savePtr = (0xFFFFFFF0) &
- pciReadLong(tag, PCI_CMD_BIOS_REG);
+ savePtr = PCIGETROM(pDev->pci_baserom);
else /* this the ROM bar */
- savePtr = (0xFFFFFFF0) &
- pciReadLong(tag, PCI_CMD_BASE_REG + (0x4 * ndx));
+ savePtr = (0xFFFFFFF0) & (&pDev->pci_base0)[ndx];
/* find the index of the incoming base */
if (base >= savePtr && base <= (savePtr + size[ndx])) {
++++++ p_pci-ce-x.diff ++++++
Index: BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c
===================================================================
--- BUILD.orig/xc/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c 2006-01-21 08:46:04.244732956 -0600
+++ BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c 2006-01-25 15:12:20.480002301 -0600
@@ -11,75 +11,6 @@
#include "xf86.h"
#include "Pci.h"
-/*
- * get_dev_on_bus - Return the first device we find on segnum, busnum
- *
- * Walk all the PCI devices and return the first one found on segnum, busnum.
- * There may be a better way to do this in some xf86* function I don't know
- * about.
- */
-static pciDevice *get_dev_on_bus(unsigned int segnum, unsigned int busnum)
-{
- pciDevice **pdev = xf86scanpci(0);
- int i;
-
- for (i = 0; pdev[i] != NULL; i++)
- if (PCI_DOM_FROM_TAG(pdev[i]->tag) == segnum &&
- pdev[i]->busnum == busnum)
- return pdev[i];
- /* Should never get here... */
- ErrorF("No PCI device found on %04x:%02x??", segnum, busnum);
- return NULL;
-}
-
-/*
- * get_bridge_info - fill in the bridge info for bus_info based on pdev
- *
- * Find the parent bus for pdev if it exists, otherwise assume pdev *is*
- * the parent bus. We need this on Altix because our bridges are transparent.
- */
-static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev)
-{
- unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag);
- unsigned int parent_busnum, parent_nodombus, busnum = pdev->busnum;
- unsigned int nodombus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(pdev->tag));
- char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge";
- char bridge_target[] = "../../../devices/pci0000:00";
-
- /* Path to this device's bridge */
- sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum,
- nodombus);
-
- if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) {
- perror("failed to dereference bridge link");
- ErrorF("failed to dereference bridge link, aborting\n");
- exit(-1);
- }
-
- sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum,
- &parent_nodombus);
-
- parent_busnum = PCI_MAKE_BUS(parent_segnum, parent_nodombus);
-
- /*
- * If there's no bridge or the bridge points to the device, use
- * pdev as the bridge
- */
- if (segnum == parent_segnum && busnum == parent_busnum) {
- bus_info->bridge = pdev;
- bus_info->secondary = FALSE;
- bus_info->primary_bus = busnum;
- } else {
- bus_info->bridge = get_dev_on_bus(parent_segnum,
- parent_busnum);
- bus_info->secondary = TRUE;
- bus_info->primary_bus = parent_busnum;
- }
- pdev->businfo = bus_info;
- pdev->pci_base_class = PCI_CLASS_DISPLAY;
- pdev->pci_sub_class = PCI_SUBCLASS_PREHISTORIC_VGA;
-}
-
void xf86PreScanAltix(void)
{
/* Nothing to see here... */
@@ -88,36 +19,65 @@
void xf86PostScanAltix(void)
{
pciConfigPtr *pdev;
- pciBusInfo_t *bus_info;
- int prevBusNum, curBusNum, idx;
+ int idx, free_idx;
/*
- * Altix PCI bridges are invisible to userspace, so we make each device
- * look like it's its own bridge unless it actually has a parent (as in
- * the case of PCI to PCI bridges).
+ * 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.
*/
- bus_info = pciBusInfo[0];
+
pdev = xf86scanpci(0);
- prevBusNum = curBusNum = pdev[0]->busnum;
- bus_info = pciBusInfo[curBusNum];
- bus_info->bridge = pdev[0];
- bus_info->secondary = FALSE;
- bus_info->primary_bus = curBusNum;
-
- /* Walk all the PCI devices, assigning their bridge info */
- for (idx = 0; pdev[idx] != NULL; idx++) {
- if (pdev[idx]->busnum == prevBusNum)
- continue; /* Already fixed up this bus */
+ for (idx = 0; pdev[idx] != NULL; idx++)
+ ;
- curBusNum = pdev[idx]->busnum;
- bus_info = pciBusInfo[curBusNum];
+ 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");
/*
- * Fill in bus_info for pdev. The bridge field will either
- * be pdev[idx] or a device on the parent bus.
+ * Construct a fake device and stick it at the end of the
+ * pdev array. Make it look like a host bridge.
*/
- get_bridge_info(bus_info, pdev[idx]);
- prevBusNum = curBusNum;
+ 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;
}
- return;
}
Index: BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c
===================================================================
--- BUILD.orig/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2006-01-21 08:46:04.252733905 -0600
+++ BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2006-01-25 16:39:26.097094793 -0600
@@ -412,8 +412,9 @@
pciBusInfo_t *pBusInfo;
while ((bus < pciNumBuses) && (pBusInfo = pciBusInfo[bus])) {
- if (bus == pBusInfo->primary_bus)
+ if (bus == pBusInfo->primary_bus) {
return pBusInfo->bridge;
+ }
bus = pBusInfo->primary_bus;
}
@@ -609,8 +610,9 @@
result = mmap(NULL, Size + Offset, prot, mmapflags, fd, realBase);
- if (!result || ((pointer)result == MAP_FAILED))
+ if (!result || ((pointer)result == MAP_FAILED)) {
return NULL;
+ }
xf86MakeNewMapping(ScreenNum, Flags, realBase, Size + Offset, result);
@@ -656,7 +658,7 @@
return fd;
}
- pBusInfo = pciBusInfo[bus];
+ pBusInfo = pciBusInfo[PCI_BUS_FROM_TAG(Tag)];
if (!pBusInfo || (bridge == pBusInfo->bridge) ||
!(bridge = pBusInfo->bridge)) {
xfree(path);
@@ -688,7 +690,7 @@
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
* legacy_mem interface is unavailable.
*/
- if (Base > 1024*1024)
+ if (Base >= 1024*1024)
return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
@@ -776,8 +778,8 @@
bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
- sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom",
- dom, bus, dom, bus, dev, func);
+ sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/rom",
+ dom, bus, dev, func);
/*
* If the caller wants the ROM and the sysfs rom interface exists,
@@ -1036,7 +1038,37 @@
}
if (sscanf(entry->d_name, "%02x . %01x", &dev, &func) == 2) {
+ CARD32 tmp;
+
pciDeviceTag = PCI_MAKE_TAG(PCI_MAKE_BUS(domain, bus), dev, func);
+
+ /*
+ * Check if the device is a pci-pci bridge. If so, make sure the
+ * primary_bus and secondary fields are set correctly.
+ */
+ tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG);
+ if ((PCI_CLASS_EXTRACT(tmp) == PCI_CLASS_BRIDGE) &&
+ (PCI_SUBCLASS_EXTRACT(tmp) == PCI_SUBCLASS_BRIDGE_PCI)) {
+
+ int sec_bus;
+ CARD32 bridge_reg;
+
+ bridge_reg = pciReadLong(pciDeviceTag, PCI_PCI_BRIDGE_BUS_REG);
+ sec_bus = PCI_SECONDARY_BUS_EXTRACT(bridge_reg, pciDeviceTag);
+
+ if (sec_bus < pciMaxBusNum) {
+ if (!pciBusInfo[sec_bus]) {
+ pciBusInfo[sec_bus] = xnfalloc(sizeof(pciBusInfo_t));
+ *pciBusInfo[sec_bus] = *pciBusInfo[0];
+ }
+
+ pciBusInfo[sec_bus]->primary_bus = PCI_MAKE_BUS(domain, bus);
+ pciBusInfo[sec_bus]->secondary = TRUE;
+ if (pciNumBuses <= sec_bus)
+ pciNumBuses = sec_bus + 1;
+ }
+ }
+
devid = pciReadLong(pciDeviceTag, PCI_ID_REG);
if ((devid & pciDevidMask) == pciDevid)
/* Yes - Return it. Otherwise, next device */
Index: BUILD/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
===================================================================
--- BUILD.orig/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c 2006-01-21 08:46:04.248733430 -0600
+++ BUILD/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c 2006-01-25 16:39:49.491878366 -0600
@@ -43,8 +43,8 @@
pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
- sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
- domain, bus, domain, bus, dev, fn);
+ sprintf(c, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/resource",
+ domain, bus, dev, fn);
if (file = fopen(c, "r")) {
for (resource=0; resource != index; resource++)
fgets(c, 0x1ff, file);
@@ -134,8 +134,8 @@
pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
- sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
- domain, bus, domain, bus, dev, fn);
+ sprintf(c, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/resource",
+ domain, bus, dev, fn);
if (file = fopen(c, "r")) {
for (resource=0; resource != index; resource++)
fgets(c, 0x1ff, file);
@@ -212,8 +212,8 @@
pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
- sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
- domain, bus, domain, bus, dev, fn);
+ sprintf(c, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/resource",
+ domain, bus, dev, fn);
if (file = fopen(c, "r")) {
unsigned long savePtr;
for (ndx=0; ndx < 7; ndx++) {
++++++ p_pci-domain.diff ++++++
? diff.fontfix
programs/Xserver/hw/xfree86/int10/helper_exec.c | 4
programs/Xserver/hw/xfree86/os-support/bus/Pci.c | 10
programs/Xserver/hw/xfree86/os-support/bus/Pci.h | 4
programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c | 9
programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c | 216 ++++++++++++++---
programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h | 2
programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c | 81 ++++++
7 files changed, 282 insertions(+), 44 deletions(-)
Index: programs/Xserver/hw/xfree86/int10/helper_exec.c
===================================================================
--- programs/Xserver/hw/xfree86/int10/helper_exec.c.orig 2005-11-30 11:35:23.000000000 +0100
+++ programs/Xserver/hw/xfree86/int10/helper_exec.c 2006-01-10 17:42:49.000000000 +0100
@@ -478,7 +478,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
return 1;
}
if (addr == 0xCFC) {
- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr));
+ *val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr));
return 1;
}
return 0;
@@ -492,7 +492,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
return 1;
}
if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr), val);
+ pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr),val);
return 1;
}
return 0;
Index: programs/Xserver/hw/xfree86/os-support/bus/Pci.c
===================================================================
--- programs/Xserver/hw/xfree86/os-support/bus/Pci.c.orig 2005-11-30 11:35:24.000000000 +0100
+++ programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2006-01-10 17:42:49.000000000 +0100
@@ -597,6 +597,16 @@ pciGetBaseSize(PCITAG tag, int index, Bo
return bits;
}
+void
+pciInfoFromTag(PCITAG tag, int *domainnum, int *busnum,
+ int *devnum, int *funcnum)
+{
+ *domainnum = PCI_DOM_FROM_TAG(tag);
+ *busnum = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
+ *devnum = PCI_DEV_FROM_TAG(tag);
+ *funcnum = PCI_FUNC_FROM_TAG(tag);
+}
+
PCITAG
pciTag(int busnum, int devnum, int funcnum)
{
Index: programs/Xserver/hw/xfree86/os-support/bus/Pci.h
===================================================================
--- programs/Xserver/hw/xfree86/os-support/bus/Pci.h.orig 2005-11-30 11:35:24.000000000 +0100
+++ programs/Xserver/hw/xfree86/os-support/bus/Pci.h 2006-01-10 17:42:49.000000000 +0100
@@ -120,7 +120,7 @@
/* by xf86scanpci */
#if defined(sun) && defined(SVR4) && defined(sparc)
# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
-#elif defined(__alpha__) && defined (linux)
+#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux)
# define MAX_PCI_DOMAINS 512
# define PCI_DOM_MASK 0x01fful
# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
@@ -259,7 +259,7 @@
# endif
#elif defined(__ia64__)
# if defined(linux)
-# define ARCH_PCI_INIT linuxPciInit
+# define ARCH_PCI_INIT ia64linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(FreeBSD)
# define ARCH_PCI_INIT freebsdPciInit
Index: programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c
===================================================================
--- programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c.orig 2005-07-03 09:01:30.000000000 +0200
+++ programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c 2006-01-10 17:42:49.000000000 +0100
@@ -41,13 +41,14 @@ static pciDevice *get_dev_on_bus(unsigne
static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev)
{
unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag);
- unsigned int parent_busnum, busnum = pdev->busnum;
+ unsigned int parent_busnum, parent_nodombus, busnum = pdev->busnum;
+ unsigned int nodombus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(pdev->tag));
char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge";
char bridge_target[] = "../../../devices/pci0000:00";
/* Path to this device's bridge */
sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum,
- busnum);
+ nodombus);
if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) {
perror("failed to dereference bridge link");
@@ -56,7 +57,9 @@ static void get_bridge_info(pciBusInfo_t
}
sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum,
- &parent_busnum);
+ &parent_nodombus);
+
+ parent_busnum = PCI_MAKE_BUS(parent_segnum, parent_nodombus);
/*
* If there's no bridge or the bridge points to the device, use
Index: programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c
===================================================================
--- programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.orig 2005-11-30 11:35:24.000000000 +0100
+++ programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2006-01-10 18:24:54.000000000 +0100
@@ -55,6 +55,7 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "Pci.h"
+#include
/*
* linux platform specific PCI access functions -- using /proc/bus/pci
@@ -73,6 +74,7 @@ static CARD8 linuxPciCfgReadByte(PCITAG
static void linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val);
static CARD16 linuxPciCfgReadWord(PCITAG tag, int off);
static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val);
+static Bool linuxDomainSupport(void);
static pciBusFuncs_t linuxFuncs0 = {
/* pciReadLong */ linuxPciCfgRead,
@@ -111,6 +113,8 @@ static pciBusInfo_t linuxPci0 = {
/* bridge */ NULL
};
+static Bool domain_support = FALSE;
+
void
linuxPciInit()
{
@@ -121,43 +125,61 @@ linuxPciInit()
we'll need a fallback for 2.0 kernels here */
return;
}
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+ domain_support = linuxDomainSupport();
+#endif
pciNumBuses = 1;
pciBusInfo[0] = &linuxPci0;
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
+
+ return;
}
static int
linuxPciOpenFile(PCITAG tag, Bool write)
{
- static int lbus,ldev,lfunc,fd = -1,is_write = 0;
- int bus, dev, func;
+ static int ldomain, lbus,ldev,lfunc,fd = -1,is_write = 0;
+ int domain, bus, dev, func;
char file[32];
struct stat ignored;
- bus = PCI_BUS_FROM_TAG(tag);
+ domain = PCI_DOM_FROM_TAG(tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
dev = PCI_DEV_FROM_TAG(tag);
func = PCI_FUNC_FROM_TAG(tag);
- if (fd == -1 || (write && (!is_write))
- || bus != lbus || dev != ldev || func != lfunc) {
- if (fd != -1)
+
+ if (!domain_support && domain > 0)
+ return -1;
+
+ if (fd == -1 || (write && (!is_write)) || bus != lbus
+ || dev != ldev || func != lfunc || domain != ldomain) {
+
+ if (fd != -1) {
close(fd);
+ fd = -1;
+ }
if (bus < 256) {
- sprintf(file,"/proc/bus/pci/%02x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%02x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ bus, dev, func);
+ else goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%02x/%02x.%1x",
+ domain, bus, dev, func);
} else {
- sprintf(file,"/proc/bus/pci/%04x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%04x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
+ bus, dev, func);
+ else goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
+ domain, bus, dev, func);
}
if (write) {
fd = open(file,O_RDWR);
@@ -171,7 +193,8 @@ linuxPciOpenFile(PCITAG tag, Bool write)
fd = open(file,O_RDONLY);
is_write = FALSE;
}
-
+ bail:
+ ldomain = domain;
lbus = bus;
ldev = dev;
lfunc = func;
@@ -482,6 +505,32 @@ linuxGetSizes(PCITAG Tag, unsigned long
}
}
+static Bool
+linuxDomainSupport(void)
+{
+ DIR *dir;
+ struct dirent *dirent;
+ char *end;
+
+ if (!(dir = opendir("/proc/bus/pci")))
+ return FALSE;
+ while (1) {
+ if (!(dirent = readdir(dir)))
+ return FALSE;
+ strtol(dirent->d_name,&end,16);
+ /* entry of the form xx or xxxx : x=[0..f] no domain */
+ if (*end == '\0')
+ return FALSE;
+ else if (*end == ':') {
+ /* ':' found immediately after: verify for xxxx:xx or xxxx:xxxx */
+ strtol(end + 1,&end,16);
+ if (*end == '\0')
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
int
xf86GetPciDomain(PCITAG Tag)
{
@@ -494,15 +543,15 @@ xf86GetPciDomain(PCITAG Tag)
return result;
if (!pPCI || pPCI->fakeDevice)
- return 1; /* Domain 0 is reserved */
+ return 0;
if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0)
- return 0;
+ return -1;
if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0)
- return 0;
+ return -1;
- return result + 1; /* Domain 0 is reserved */
+ return result;
}
static pointer
@@ -574,7 +623,7 @@ linuxMapPci(int ScreenNum, int Flags, PC
return NULL;
}
-#define MAX_DOMAINS 257
+#define MAX_DOMAINS 256
static pointer DomainMmappedIO[MAX_DOMAINS];
static pointer DomainMmappedMem[MAX_DOMAINS];
@@ -596,11 +645,10 @@ linuxOpenLegacy(PCITAG Tag, char *name)
domain = xf86GetPciDomain(Tag);
bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
- /* Domain 0 is reserved -- see xf86GetPciDomain() */
- if ((domain <= 0) || (domain >= MAX_DOMAINS))
+ if ((domain < 0) || (domain >= MAX_DOMAINS))
FatalError("linuxOpenLegacy(): domain out of range\n");
- sprintf(path, PREFIX, domain - 1, bus, name);
+ sprintf(path, PREFIX, domain, bus, name);
fd = open(path, O_RDWR);
if (fd >= 0) {
xfree(path);
@@ -685,7 +733,7 @@ xf86MapDomainIO(int ScreenNum, int Flags
int domain = xf86GetPciDomain(Tag);
int fd;
- if ((domain <= 0) || (domain >= MAX_DOMAINS))
+ if ((domain < 0) || (domain >= MAX_DOMAINS))
FatalError("xf86MapDomainIO(): domain out of range\n");
if (DomainMmappedIO[domain])
@@ -724,7 +772,7 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS
struct stat st;
dom = PCI_DOM_FROM_TAG(Tag);
- bus = PCI_BUS_FROM_TAG(Tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom",
@@ -831,7 +879,7 @@ xf86PciBusAccWindowsFromOS(void)
RANGE_TYPE(ResExcIoBlock, domain));
pRes = xf86AddResToList(pRes, &range, -1);
- if (domain <= 0)
+ if (domain < 0)
break;
}
}
@@ -883,7 +931,7 @@ xf86AccResFromOS(resPtr pRes)
RANGE_TYPE(ResExcIoBlock, domain));
pRes = xf86AddResToList(pRes, &range, -1);
- if (domain <= 0)
+ if (domain < 0)
break;
}
}
@@ -892,3 +940,105 @@ xf86AccResFromOS(resPtr pRes)
}
#endif /* !INCLUDE_XF86_NO_DOMAIN */
+
+#ifdef __ia64__
+static PCITAG ia64linuxPciFindFirst(void);
+static PCITAG ia64linuxPciFindNext(void);
+
+void
+ia64linuxPciInit()
+{
+ struct stat st;
+
+ linuxPciInit();
+
+ if (!stat("/proc/sgi_sn/licenseID", &st) && pciNumBuses) {
+ /* Be a little paranoid here and only use this code for Altix systems.
+ * It is generic, so it should work on any system, but depends on
+ * /proc/bus/pci entries for each domain/bus combination. Altix is
+ * guaranteed a recent enough kernel to have them.
+ */
+ pciFindFirstFP = ia64linuxPciFindFirst;
+ pciFindNextFP = ia64linuxPciFindNext;
+ }
+}
+
+static DIR *busdomdir;
+static DIR *devdir;
+
+static PCITAG
+ia64linuxPciFindFirst(void)
+{
+ busdomdir = opendir("/proc/bus/pci");
+ devdir = NULL;
+
+ return ia64linuxPciFindNext();
+}
+
+static struct dirent *getnextbus(int *domain, int *bus)
+{
+ struct dirent *entry;
+ int dombus;
+
+ for (;;) {
+ entry = readdir(busdomdir);
+ if (entry == NULL) {
+ *domain = 0;
+ *bus = 0;
+ closedir(busdomdir);
+ return NULL;
+ }
+ if (sscanf(entry->d_name, "%04x:%02x", domain, bus) != 2)
+ continue;
+ dombus = PCI_MAKE_BUS(*domain, *bus);
+
+ if (pciNumBuses <= dombus)
+ pciNumBuses = dombus + 1;
+ if (!pciBusInfo[dombus]) {
+ pciBusInfo[dombus] = xnfalloc(sizeof(pciBusInfo_t));
+ *pciBusInfo[dombus] = *pciBusInfo[0];
+ }
+
+ return entry;
+ }
+}
+
+static PCITAG
+ia64linuxPciFindNext(void)
+{
+ struct dirent *entry;
+ char file[40];
+ static int bus, dev, func, domain;
+ PCITAG pciDeviceTag;
+ CARD32 devid;
+
+ for (;;) {
+ if (devdir == NULL) {
+ entry = getnextbus(&domain, &bus);
+ if (!entry)
+ return PCI_NOT_FOUND;
+ snprintf(file, 40, "/proc/bus/pci/%s", entry->d_name);
+ devdir = opendir(file);
+ if (!devdir)
+ return PCI_NOT_FOUND;
+
+ }
+
+ entry = readdir(devdir);
+
+ if (entry == NULL) {
+ closedir(devdir);
+ devdir = NULL;
+ continue;
+ }
+
+ if (sscanf(entry->d_name, "%02x . %01x", &dev, &func) == 2) {
+ pciDeviceTag = PCI_MAKE_TAG(PCI_MAKE_BUS(domain, bus), dev, func);
+ devid = pciReadLong(pciDeviceTag, PCI_ID_REG);
+ if ((devid & pciDevidMask) == pciDevid)
+ /* Yes - Return it. Otherwise, next device */
+ return pciDeviceTag;
+ }
+ }
+}
+#endif
Index: programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h
===================================================================
--- programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h.orig 2005-11-30 11:35:24.000000000 +0100
+++ programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h 2006-01-10 17:42:49.000000000 +0100
@@ -768,6 +768,8 @@ void pciSetBitsByte(PCITAG tag, in
ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
PCITAG pciTag(int busnum, int devnum, int funcnum);
+void pciInfoFromTag(PCITAG tag, int *domainnum,
+ int *busnum, int *devnum, int *funcnum);
int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min);
CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg);
pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag,
Index: programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
===================================================================
--- programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c.orig 2005-11-30 11:35:25.000000000 +0100
+++ programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c 2006-01-10 17:42:49.000000000 +0100
@@ -28,16 +28,41 @@ FILE *xf86OSLinuxPCIFile = NULL;
Bool
xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
{
+ FILE *file;
char c[0x200];
char *res;
- unsigned int bus, devfn, dev, fn;
+ unsigned int domain, bus, devfn, dev, fn;
unsigned PCIADDR_TYPE size[7];
unsigned int num;
signed PCIADDR_TYPE Size;
+ int resource;
+ unsigned PCIADDR_TYPE begin, end;
if (index > 7)
return FALSE;
-
+
+ pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
+
+ sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
+ domain, bus, domain, bus, dev, fn);
+ if (file = fopen(c, "r")) {
+ for (resource=0; resource != index; resource++)
+ fgets(c, 0x1ff, file);
+ res = fgets(c, 0x1ff, file);
+ num = sscanf(res, PCIADDR_FMT " " PCIADDR_FMT " " PCIADDR_IGNORE_FMT,
+ &begin, &end);
+ if (num == 2) {
+ Size = end - begin;
+ while (Size & ((PCIADDR_TYPE) 0x01)) {
+ Size = Size >> ((PCIADDR_TYPE) 1);
+ (*bits)++;
+ }
+ fclose(file);
+ return TRUE;
+ }
+ fclose(file);
+ }
+
if (!xf86OSLinuxPCIFile && \
!(xf86OSLinuxPCIFile = fopen("/proc/bus/pci/devices","r")))
return FALSE;
@@ -99,13 +124,32 @@ xf86GetPciOffsetFromOS(PCITAG tag, int i
FILE *file;
char c[0x200];
char *res;
- unsigned int bus, devfn, dev, fn;
+ unsigned int domain, bus, devfn, dev, fn;
unsigned PCIADDR_TYPE offset[7];
unsigned int num;
+ int resource;
if (index > 7)
return FALSE;
+ pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
+
+ sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
+ domain, bus, domain, bus, dev, fn);
+ if (file = fopen(c, "r")) {
+ for (resource=0; resource != index; resource++)
+ fgets(c, 0x1ff, file);
+ res = fgets(c, 0x1ff, file);
+ num = sscanf(res, PCIADDR_FMT " " PCIADDR_IGNORE_FMT " " PCIADDR_IGNORE_FMT,
+ &offset[0]);
+ if (num == 1) {
+ *bases = offset[0];
+ fclose(file);
+ return TRUE;
+ }
+ fclose(file);
+ }
+
if (!(file = fopen("/proc/bus/pci/devices","r")))
return FALSE;
do {
@@ -159,11 +203,40 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int s
FILE *file;
char c[0x200];
char *res;
- unsigned int bus, devfn, dev, fn;
+ unsigned int domain, bus, devfn, dev, fn;
unsigned PCIADDR_TYPE offset[7];
unsigned PCIADDR_TYPE size[7];
unsigned int num;
unsigned int ndx;
+ unsigned PCIADDR_TYPE begin,end;
+
+ pciInfoFromTag(tag, &domain, &bus, &dev, &fn);
+
+ sprintf(c, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/resource",
+ domain, bus, domain, bus, dev, fn);
+ if (file = fopen(c, "r")) {
+ unsigned long savePtr;
+ for (ndx=0; ndx < 7; ndx++) {
+ res = fgets(c, 0x1ff, file);
+ if (!res)
+ break;
+ num = sscanf(res, PCIADDR_FMT " " PCIADDR_FMT " " PCIADDR_IGNORE_FMT,
+ &begin, &end);
+ if (num == 2) {
+ if (ndx == 6)
+ savePtr = (0xFFFFFFF0) &
+ pciReadLong(tag, PCI_CMD_BIOS_REG);
+ else /* this the ROM bar */
+ savePtr = (0xFFFFFFF0) &
+ pciReadLong(tag, PCI_CMD_BASE_REG + (0x4 * ndx));
+ if (base >= savePtr && base <= (savePtr + (end - begin))) {
+ fclose(file);
+ return ( ~(0xFUL) & (begin + (base - savePtr)));
+ }
+ }
+ }
+ fclose(file);
+ }
if (!(file = fopen("/proc/bus/pci/devices","r")))
return 0;
++++++ p_pci-ia64.diff ++++++
Index: linuxPci.c
===================================================================
RCS file: /work/cvsdir/cvs/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v
retrieving revision 1.1.1.12
diff -u -r1.1.1.12 linuxPci.c
--- linuxPci.c 25 Nov 2005 10:05:28 -0000 1.1.1.12
+++ linuxPci.c 16 Feb 2006 11:21:06 -0000
@@ -517,9 +517,7 @@
xf86InitVidMem();
- pPCI = xf86GetPciHostConfigFromTag(Tag);
-
- if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) ||
+ if (((fd = linuxPciOpenFile(Tag ,FALSE)) < 0) ||
(ioctl(fd, mmap_ioctl, 0) < 0))
break;
++++++ p_pci-legacy-mmap.diff ++++++
If we're mapping something in the "legacy range" (0-1Mb), we shouldn't
expand the requested range to the entire 0-1Mb range. Typically this
is for mapping the VGA frame buffer, and some platforms support mmap of
the frame buffer but not the entire 0-1Mb range.
For example, HP sx1000 and sx2000 ia64 platforms can have memory from
0-0x9ffff, VGA frame buffer from 0xa0000-0xbffff, and memory from
0xc0000-0xfffff. On these platforms, we can't map the entire 0-1Mb
range with the same attribute because the memory only supports WB,
while the frame buffer supports only UC. But an mmap of just the
frame buffer should work fine.
--- BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.orig 2006-04-03 08:27:52.000000000 -0600
+++ BUILD/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2006-04-03 08:33:26.000000000 -0600
@@ -625,7 +625,6 @@
#define MAX_DOMAINS 256
static pointer DomainMmappedIO[MAX_DOMAINS];
-static pointer DomainMmappedMem[MAX_DOMAINS];
static int
linuxOpenLegacy(PCITAG Tag, char *name)
@@ -682,6 +681,7 @@
{
int domain = xf86GetPciDomain(Tag);
int fd;
+ pointer addr;
/*
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
@@ -695,20 +695,14 @@
return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
-
- /* If we haven't already mapped this legacy space, try to. */
- if (!DomainMmappedMem[domain]) {
- DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, 0);
- if (DomainMmappedMem[domain] == MAP_FAILED) {
- close(fd);
- perror("mmap failure");
- FatalError("xf86MapDomainMem(): mmap() failure\n");
- }
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+ if (addr == MAP_FAILED) {
+ close (fd);
+ perror("mmap failure");
+ FatalError("xf86MapDomainMem(): mmap() failure\n");
}
-
close(fd);
- return (pointer)((char *)DomainMmappedMem[domain] + Base);
+ return addr;
}
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org