summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2018-05-21 20:02:29 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2018-05-21 20:02:29 +0000
commitc000d854fdcaf35dd709462e1bf7d0a71bd790e3 (patch)
treef6546a53da10d3cd02aece8e67123ee437da6cbb /lib
parentc9a0a6e9ef038917b8f9f39103f1eec0d4bf9e2d (diff)
Update to libpciaccess 0.14
Diffstat (limited to 'lib')
-rw-r--r--lib/libpciaccess/ChangeLog309
-rw-r--r--lib/libpciaccess/aclocal.m464
-rw-r--r--lib/libpciaccess/compile9
-rw-r--r--lib/libpciaccess/configure102
-rw-r--r--lib/libpciaccess/configure.ac6
-rw-r--r--lib/libpciaccess/include/pciaccess.h15
-rw-r--r--lib/libpciaccess/src/common_capability.c3
-rw-r--r--lib/libpciaccess/src/common_device_name.c10
-rw-r--r--lib/libpciaccess/src/common_init.c3
-rw-r--r--lib/libpciaccess/src/common_interface.c3
-rw-r--r--lib/libpciaccess/src/common_io.c3
-rw-r--r--lib/libpciaccess/src/common_iterator.c3
-rw-r--r--lib/libpciaccess/src/common_map.c3
-rw-r--r--lib/libpciaccess/src/common_vgaarb.c12
-rw-r--r--lib/libpciaccess/src/common_vgaarb_stub.c3
-rw-r--r--lib/libpciaccess/src/linux_devmem.c5
-rw-r--r--lib/libpciaccess/src/linux_sysfs.c76
-rw-r--r--lib/libpciaccess/src/netbsd_pci.c4
-rw-r--r--lib/libpciaccess/src/openbsd_pci.c7
-rw-r--r--lib/libpciaccess/src/solx_devfs.c58
-rw-r--r--lib/libpciaccess/src/x86_pci.c6
21 files changed, 594 insertions, 110 deletions
diff --git a/lib/libpciaccess/ChangeLog b/lib/libpciaccess/ChangeLog
index d068ea686..970bf7b99 100644
--- a/lib/libpciaccess/ChangeLog
+++ b/lib/libpciaccess/ChangeLog
@@ -1,3 +1,300 @@
+commit 13854f603f720c45caf51d785a874d3c7e8c5f58
+Author: Adam Jackson <ajax@redhat.com>
+Date: Mon Oct 23 11:44:32 2017 -0400
+
+ libpciaccess 0.14
+
+ Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit a167bd6474522a709ff3cbb00476c0e4309cb66f
+Author: Stephen Hemminger <stephen@networkplumber.org>
+Date: Mon Sep 18 13:17:23 2017 -0400
+
+ linux: support 32 bit PCI domains (v3)
+
+ The PCI domain may be larger than 16 bits on Microsoft Azure and other
+ virtual environments. PCI busses reported by ACPI are limited to 16
+ bits, but in Azure the domain value for pass through devices is
+ intentionally larger than 16 bits to avoid clashing with local devices.
+ This is needed to support pass through of GPU devices.
+
+ v3: (ajax)
+ Update FreeBSD and Solaris backends to preserve the full 32-bit domain
+ number, since on those OSes it stands a chance of working already.
+ Update NetBSD and OpenBSD backends to initialize domain_16 compatibly
+ with older libpciaccess; neither backend appears to support more than a
+ handful of domains to begin with though. Trivially update the generic
+ x86 backend for source compatibility, though it still only supports one
+ domain and will never be better.
+
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101744
+ Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
+ Reviewed-by: Eric Anholt <eric@anholt.net>
+
+commit 4f1ac52e828eed1c410ee66304fcb7a17f25da40
+Author: Emil Velikov <emil.velikov@collabora.com>
+Date: Tue Apr 4 14:40:41 2017 +0100
+
+ libpciaccess 0.13.5
+
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 9b9d26ce7646713e148c7ee0f461c2bcccdd5201
+Author: Emil Velikov <emil.velikov@collabora.com>
+Date: Tue Apr 4 13:48:46 2017 +0100
+
+ configure.ac: set AC_CONFIG_AUX_DIR
+
+ If not set, libtool will search directories up to ../.. for an install-sh and
+ then dump the aux files there. This caused a couple of problems with the xorg
+ release.sh script that now uses worktrees but is generally bad behaviour
+ because we can't guarantee that we're not inside some other repository.
+
+ Set AC_CONFIG_AUX_DIR to avoid this behavior.
+
+ See https://lists.freedesktop.org/archives/xorg-devel/2017-March/053006.html
+
+ Note: the commit and above message are shamelessly copied from libinput.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 504a65a732ea070dce907fce827a15d6b61e0c4d
+Author: Emil Velikov <emil.velikov@collabora.com>
+Date: Tue Apr 4 13:33:29 2017 +0100
+
+ configure.ac: remove AC_CONFIG_SRCDIR macro
+
+ It is used to guide people who incorrectly set configure --srcdir.
+
+ To be actually useful the macro should point to a rather unique file -
+ which in our current case is a false premise. We have five Makefile.am
+ in-tree and chances are that $libpciaccess/.. may also contain such a
+ file.
+
+ Let's not pretend that its useful and leave the user to what they're
+ asking for.
+
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit fe556c48dad96717b0ba71d489575c6b90b46448
+Author: Henry Zhao <henry.zhao@oracle.com>
+Date: Wed May 25 14:06:49 2016 -0700
+
+ use cached devinfo snapshots, remove unnecessary di_init()
+
+ Use cached devinfo (DINFOCACHE) in di_init().
+ Remove unnecessary di_init() on nexus nodes.
+
+ Signed-off-by: Henry Zhao <henry.zhao@oracle.com>
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 0bd248f852f1f2a37396c98519eee6f50c434848
+Author: Henry Zhao <henry.zhao@oracle.com>
+Date: Wed May 25 14:04:40 2016 -0700
+
+ probe should not hold pci nexus drivers open
+
+ Probe should not hold pci nexus drivers open - close after use.
+
+ Signed-off-by: Henry Zhao <henry.zhao@oracle.com>
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 85a484b94d5cdcad31c3caf8b0fa52e6f50dec96
+Author: Emil Velikov <emil.l.velikov@gmail.com>
+Date: Thu Dec 1 18:14:40 2016 +0000
+
+ Revert "linux_sysfs: include <limits.h> for PATH_MAX"
+
+ This reverts commit 8ea3af620a2d4ad5648917b4a0ef2b23ff566774.
+
+ The include was added with 6bd2f7f92eae713663f4e13f6e2cb23526607b8c
+
+ Cc: Adam Jackson <ajax@redhat.com>
+
+commit e787ec28e433a24195f37012dad23bce468b330a
+Author: Mihail Konev <k.mvc@ya.ru>
+Date: Thu Jan 26 13:52:49 2017 +1000
+
+ autogen: add default patch prefix
+
+ Signed-off-by: Mihail Konev <k.mvc@ya.ru>
+
+commit cdb2bfc9668895431e73335fc0490c4cbfa3023a
+Author: Emil Velikov <emil.l.velikov@gmail.com>
+Date: Thu Jan 26 12:04:14 2017 +1000
+
+ autogen.sh: use quoted string variables
+
+ Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
+ fall-outs, when they contain space.
+
+ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f46a7a83e42fcd0601b21e361ea7fbf056d11fce
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Jan 26 12:03:12 2017 +1000
+
+ autogen.sh: use exec instead of waiting for configure to finish
+
+ Syncs the invocation of configure with the one from the server.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 73db249c4b1eb91e0df27a1045bea344371dd2ca
+Author: Emil Velikov <emil.velikov@collabora.com>
+Date: Thu Dec 1 18:17:35 2016 +0000
+
+ linux sysfs: retrieve vendor, device... info via separate sysfs files
+
+ Currently the kernel does not expose the revision file. With that about
+ to change (due in 4.10) we can read all the information required from
+ separate files and avoid opening the config one.
+
+ The latter has the [negative] side effect of waking up the device, which
+ in some cases can be quite costly.
+
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
+
+commit 099489b7917da44de57f3214425ea9b4a8f36482
+Author: Keith Busch <keith.busch@intel.com>
+Date: Wed Aug 10 17:05:23 2016 -0600
+
+ Ignore 32-bit domains
+
+ A pci "domain" need not be limited to the 16-bits. The Linux kernel
+ currently supports 32-bit domains which cause startx to segfault. Updating
+ libpciaccess to support 32-bit domains breaks the library's ABI, and
+ domains requiring 32-bits are not necessary for startx anyway, so this
+ patch ignores them.
+
+ Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
+ Signed-off-by: Keith Busch <keith.busch@intel.com>
+ Reviewed-by: Eric Anholt <eric@anholt.net>
+
+commit 201d1a7623c83f611761f67d4411c3c266f8f37a
+Author: arsharma <ankitprasad.r.sharma@intel.com>
+Date: Mon Feb 23 21:31:07 2015 +0000
+
+ device-name: handle calloc failure in insert()
+
+ Issue was spotted by Klocwork, and fixed by arsharma as part of
+ Android-ia.
+
+ Just bail out if memory allocation fails. All the callers of insert()
+ already handle the case.
+
+ [Emil Velikov: Split from larger patch, write commit message]
+ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+
+commit af2fdf1bdc4532410f49fc0854ae4c0f9086cce9
+Author: arsharma <ankitprasad.r.sharma@intel.com>
+Date: Mon Feb 23 21:31:06 2015 +0000
+
+ vgaarb: add a the trailing NULL character on read(vgaarb_fd)
+
+ Issue was spotted by Klocwork, and fixed by arsharma as part of
+ Android-ia. Not 100% sure if the data read from /dev/vga_arbiter is not
+ already null terminated, but making sure won't hurt either.
+
+ [Emil Velikov: Split from larger patch, write commit message]
+ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+
+commit c1de5dc0541e58372dcddc5120e1e68e03f4f619
+Author: Chuck Tuffli <chuck@tuffli.net>
+Date: Thu Feb 6 18:09:35 2014 -0800
+
+ libpciaccess: Fix incorrect format specification
+
+ Building libpciaccess generates a warning on versions of Linux in which
+ the definition of the struct mtrr_sentry has changed to __u64.
+
+ Since sentry.base is assigned from a pciaddr_t, always cast sentry.base
+ to be type pciaddr_t and modify the formatting string to use PRIx64
+ instead of %08lx
+
+ Verified on Ubuntu 10.04 and 14.04
+
+ Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74643
+
+ Signed-off-by: Chuck Tuffli <chuck@tuffli.net>
+
+commit 8ea3af620a2d4ad5648917b4a0ef2b23ff566774
+Author: Felix Janda <felix.janda@posteo.de>
+Date: Thu Dec 4 23:52:22 2014 +0100
+
+ linux_sysfs: include <limits.h> for PATH_MAX
+
+ Signed-off-by: Felix Janda <felix.janda@posteo.de>
+ Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+
+commit 42240dcbbce8ec744401d4a464f71c3fbd3fca1b
+Author: Emil Velikov <emil.l.velikov@gmail.com>
+Date: Mon Mar 9 11:57:40 2015 +0000
+
+ autogen.sh: pass --force to autoreconf, quote string variables
+
+ By passing --force autoreconf will update all the aux files, which would
+ otherwise be ignored if one updates autoconf/automake.
+
+ Quote the $srcdir, $ORIGDIR and $0 variables to prevent fall-outs, when
+ it contains space.
+
+ v2: Also handle $srcdir and $0.
+
+ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
+
+commit e99c005d623a74287bbfafffc0c7040c31cdb01f
+Author: Adam Jackson <ajax@redhat.com>
+Date: Tue Sep 22 08:38:56 2015 -0400
+
+ chmod a-x README.cygwin
+
+ Signed-off-by: Adam Jackson <ajax@redhat.com>
+
+commit 6bd2f7f92eae713663f4e13f6e2cb23526607b8c
+Author: Felix Janda <felix.janda@posteo.de>
+Date: Fri May 1 16:36:50 2015 +0200
+
+ linux_sysfs.c: Include <limits.h> for PATH_MAX
+
+ Fixes compilation with musl libc.
+
+ Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+ Signed-off-by: Felix Janda <felix.janda@posteo.de>
+ Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 765e0a38cb8c40f8865af5cb356ffe6039ffb08f
+Author: Thomas Klausner <wiz@NetBSD.org>
+Date: Sun Mar 22 21:38:23 2015 +0100
+
+ Fix quoting issue.
+
+ m4 has '[]' as quoting characters, so if we want '[]' to
+ end up in the configure script, we need to quote them again.
+
+ Reported by Greg Troxel <gdt@ir.bbn.com>.
+
+ Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
+ Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit b14696a55796e739624bbda4f772427032efff2a
+Author: Julien Cristau <jcristau@debian.org>
+Date: Sun Apr 26 15:20:57 2015 +0200
+
+ Include config.h before anything else in *.c
+
+ Debian bug#749008 <https://bugs.debian.org/749008>
+
+ Reported-by: Michael Tautschnig <mt@debian.org>
+ Signed-off-by: Julien Cristau <jcristau@debian.org>
+ Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
commit bbd1acdd1d25b9a68f4b7913a4094af20d7cf78f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Apr 30 21:44:41 2015 -0700
@@ -1774,11 +2071,11 @@ Date: Fri Feb 27 00:34:28 2009 -0600
FreeBSD: Incorporate several fixes that have accumulated.
- -Don't frob the BARs while they are enabled
- -Find proper pci bios address / length
- -Use the new PCIOCGETBAR ioctl if it exists
- rather than frob the BARs ourself
- -Write must also be a power of two
+ -Don't frob the BARs while they are enabled
+ -Find proper pci bios address / length
+ -Use the new PCIOCGETBAR ioctl if it exists
+ rather than frob the BARs ourself
+ -Write must also be a power of two
commit 5855cf5a2cc7ee920b42052372ab734003799d00
Author: Alan Coopersmith <alan.coopersmith@sun.com>
@@ -2520,7 +2817,7 @@ Date: Tue Nov 14 14:37:46 2006 -0800
Conflicts:
- src/Makefile.am
+ src/Makefile.am
commit 07b09d930ed2b7eae299ae036ec30099374b95aa
Author: Eric Anholt <anholt@FreeBSD.org>
diff --git a/lib/libpciaccess/aclocal.m4 b/lib/libpciaccess/aclocal.m4
index a3b057b95..05695e4fa 100644
--- a/lib/libpciaccess/aclocal.m4
+++ b/lib/libpciaccess/aclocal.m4
@@ -1248,7 +1248,7 @@ m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
-dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@@ -1285,7 +1285,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
-m4_define([vers_have], [1.19.0])
+m4_define([vers_have], [1.19.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -1363,6 +1363,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_SED])
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
+ [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
+
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@@ -1378,9 +1389,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -1388,9 +1399,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -1398,9 +1409,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -1408,9 +1419,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -1671,13 +1682,24 @@ m4_ifval([$1],
fi])
# Test for the ability of xmlto to generate a text target
+#
+# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
+# following test for empty XML docbook files.
+# For compatibility reasons use the following empty XML docbook file and if
+# it fails try it again with a non-empty XML file.
have_xmlto_text=no
cat > conftest.xml << "EOF"
EOF
AS_IF([test "$have_xmlto" = yes],
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
- [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
+ [# Try it again with a non-empty XML file.
+ cat > conftest.xml << "EOF"
+<x></x>
+EOF
+ AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
+ [have_xmlto_text=yes],
+ [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
rm -f conftest.xml
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
@@ -3073,8 +3095,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
-|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
-echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
+|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
+touch \$(top_srcdir)/INSTALL; \
+echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
AC_SUBST([INSTALL_CMD])
]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc
@@ -3135,10 +3158,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
#
#
AC_DEFUN([XORG_CHANGELOG], [
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
AC_SUBST([CHANGELOG_CMD])
]) # XORG_CHANGELOG
diff --git a/lib/libpciaccess/compile b/lib/libpciaccess/compile
index a85b723c7..2ab71e4ea 100644
--- a/lib/libpciaccess/compile
+++ b/lib/libpciaccess/compile
@@ -1,9 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2016-01-11.22; # UTC
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion"
exit $?
;;
- cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
@@ -342,6 +343,6 @@ exit $ret
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
diff --git a/lib/libpciaccess/configure b/lib/libpciaccess/configure
index 475567c04..4606610cb 100644
--- a/lib/libpciaccess/configure
+++ b/lib/libpciaccess/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libpciaccess 0.13.4.
+# Generated by GNU Autoconf 2.69 for libpciaccess 0.14.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess>.
#
@@ -591,12 +591,11 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpciaccess'
PACKAGE_TARNAME='libpciaccess'
-PACKAGE_VERSION='0.13.4'
-PACKAGE_STRING='libpciaccess 0.13.4'
+PACKAGE_VERSION='0.14'
+PACKAGE_STRING='libpciaccess 0.14'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess'
PACKAGE_URL=''
-ac_unique_file="Makefile.am"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@@ -1363,7 +1362,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libpciaccess 0.13.4 to adapt to many kinds of systems.
+\`configure' configures libpciaccess 0.14 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1433,7 +1432,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libpciaccess 0.13.4:";;
+ short | recursive ) echo "Configuration of libpciaccess 0.14:";;
esac
cat <<\_ACEOF
@@ -1559,7 +1558,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libpciaccess configure 0.13.4
+libpciaccess configure 0.14
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2031,7 +2030,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libpciaccess $as_me 0.13.4, which was
+It was created by libpciaccess $as_me 0.14, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2379,15 +2378,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
ac_config_headers="$ac_config_headers config.h"
-
-# Initialize Automake
-am__api_version='1.12'
-
ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+for ac_dir in . "$srcdir"/.; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
@@ -2403,7 +2397,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -2415,6 +2409,10 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+# Initialize Automake
+am__api_version='1.12'
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -2860,7 +2858,7 @@ fi
# Define the identity of the package.
PACKAGE='libpciaccess'
- VERSION='0.13.4'
+ VERSION='0.14'
cat >>confdefs.h <<_ACEOF
@@ -17611,10 +17609,11 @@ _ACEOF
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
@@ -17622,13 +17621,44 @@ echo 'git directory not found: installing possibly empty changelog.' >&2)"
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
-|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
-echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
+|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
+touch \$(top_srcdir)/INSTALL; \
+echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
+
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5
+$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; }
+if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ test "$cross_compiling" = yes &&
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/usr/share/man/man7/attributes.7"; then
+ ac_cv_file__usr_share_man_man7_attributes_7=yes
+else
+ ac_cv_file__usr_share_man_man7_attributes_7=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5
+$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; }
+if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then :
+ SYSV_MAN_SECTIONS=false
+else
+ SYSV_MAN_SECTIONS=true
+fi
+
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
@@ -17645,9 +17675,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -17655,9 +17685,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -17665,9 +17695,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -17675,9 +17705,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -17867,7 +17897,7 @@ case $host_os in
;;
*netbsd*)
case $host in
- *i3-986*)
+ *i[3-9]86*)
PCIACCESS_LIBS="$PCIACCESS_LIBS -li386"
;;
*x86_64*|*amd64*)
@@ -18795,7 +18825,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libpciaccess $as_me 0.13.4, which was
+This file was extended by libpciaccess $as_me 0.14, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18861,7 +18891,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libpciaccess config.status 0.13.4
+libpciaccess config.status 0.14
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/lib/libpciaccess/configure.ac b/lib/libpciaccess/configure.ac
index e67e9e11d..0774b1dcd 100644
--- a/lib/libpciaccess/configure.ac
+++ b/lib/libpciaccess/configure.ac
@@ -23,10 +23,10 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libpciaccess],[0.13.4],
+AC_INIT([libpciaccess],[0.14],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
-AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_AUX_DIR([.])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -76,7 +76,7 @@ case $host_os in
;;
*netbsd*)
case $host in
- *i[3-9]86*)
+ *i[[3-9]]86*)
PCIACCESS_LIBS="$PCIACCESS_LIBS -li386"
;;
*x86_64*|*amd64*)
diff --git a/lib/libpciaccess/include/pciaccess.h b/lib/libpciaccess/include/pciaccess.h
index 1d7aa4bea..8167be6f6 100644
--- a/lib/libpciaccess/include/pciaccess.h
+++ b/lib/libpciaccess/include/pciaccess.h
@@ -311,6 +311,10 @@ struct pci_mem_region {
* PCI device.
*
* Contains all of the information about a particular PCI device.
+ *
+ * This structure - like everything else in libpciaccess - is allocated
+ * by the library itself. Do not embed this structure in other structs,
+ * or otherwise allocate them yourself.
*/
struct pci_device {
/**
@@ -319,9 +323,12 @@ struct pci_device {
* Complete bus identification, including domain, of the device. On
* platforms that do not support PCI domains (e.g., 32-bit x86 hardware),
* the domain will always be zero.
+ *
+ * The domain_16 field is provided for binary compatibility with older
+ * libpciaccess.
*/
/*@{*/
- uint16_t domain;
+ uint16_t domain_16;
uint8_t bus;
uint8_t dev;
uint8_t func;
@@ -385,6 +392,12 @@ struct pci_device {
* Used by the VGA arbiter. Type of resource decoded by the device and
* the file descriptor (/dev/vga_arbiter). */
int vgaarb_rsrc;
+
+
+ /**
+ * PCI domain value (full 32 bits)
+ */
+ uint32_t domain;
};
diff --git a/lib/libpciaccess/src/common_capability.c b/lib/libpciaccess/src/common_capability.c
index 488743dd6..15d395d98 100644
--- a/lib/libpciaccess/src/common_capability.c
+++ b/lib/libpciaccess/src/common_capability.c
@@ -31,6 +31,9 @@
*
* \author Ian Romanick <idr@us.ibm.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <stdio.h>
diff --git a/lib/libpciaccess/src/common_device_name.c b/lib/libpciaccess/src/common_device_name.c
index a990ac8a5..3dd35d7e3 100644
--- a/lib/libpciaccess/src/common_device_name.c
+++ b/lib/libpciaccess/src/common_device_name.c
@@ -154,6 +154,10 @@ insert( uint16_t vendor )
if ( tree == NULL ) {
tree = calloc( 1, sizeof( struct pci_id_node ) );
+
+ if ( tree == NULL )
+ return NULL;
+
tree->bits = 4;
}
@@ -175,6 +179,9 @@ insert( uint16_t vendor )
struct pci_id_node * child =
calloc( 1, sizeof( struct pci_id_node ) );
+ if ( tree == NULL )
+ return NULL;
+
child->bits = 4;
n->children[ idx ] = child;
@@ -183,6 +190,9 @@ insert( uint16_t vendor )
struct pci_id_leaf * leaf =
calloc( 1, sizeof( struct pci_id_leaf ) );
+ if ( tree == NULL )
+ return NULL;
+
leaf->vendor = vendor;
n->children[ idx ] = (struct pci_id_node *) leaf;
diff --git a/lib/libpciaccess/src/common_init.c b/lib/libpciaccess/src/common_init.c
index b1c0c3e19..f7b59bd3f 100644
--- a/lib/libpciaccess/src/common_init.c
+++ b/lib/libpciaccess/src/common_init.c
@@ -28,6 +28,9 @@
*
* \author Ian Romanick <idr@us.ibm.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <errno.h>
diff --git a/lib/libpciaccess/src/common_interface.c b/lib/libpciaccess/src/common_interface.c
index 59778cfbf..cb95e90b4 100644
--- a/lib/libpciaccess/src/common_interface.c
+++ b/lib/libpciaccess/src/common_interface.c
@@ -28,6 +28,9 @@
*
* \author Ian Romanick <idr@us.ibm.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libpciaccess/src/common_io.c b/lib/libpciaccess/src/common_io.c
index f5c9e45bf..e9586adbc 100644
--- a/lib/libpciaccess/src/common_io.c
+++ b/lib/libpciaccess/src/common_io.c
@@ -22,6 +22,9 @@
* Author:
* Adam Jackson <ajax@redhat.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libpciaccess/src/common_iterator.c b/lib/libpciaccess/src/common_iterator.c
index ccf656d20..2beb18052 100644
--- a/lib/libpciaccess/src/common_iterator.c
+++ b/lib/libpciaccess/src/common_iterator.c
@@ -28,6 +28,9 @@
*
* \author Ian Romanick <idr@us.ibm.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libpciaccess/src/common_map.c b/lib/libpciaccess/src/common_map.c
index 8757151cc..f1854bbe8 100644
--- a/lib/libpciaccess/src/common_map.c
+++ b/lib/libpciaccess/src/common_map.c
@@ -21,6 +21,9 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <sys/types.h>
#include <sys/mman.h>
diff --git a/lib/libpciaccess/src/common_vgaarb.c b/lib/libpciaccess/src/common_vgaarb.c
index 7a7d204c9..515275f43 100644
--- a/lib/libpciaccess/src/common_vgaarb.c
+++ b/lib/libpciaccess/src/common_vgaarb.c
@@ -126,7 +126,7 @@ int
pci_device_vgaarb_init(void)
{
struct pci_slot_match match;
- char buf[BUFSIZE];
+ char buf[BUFSIZE + 1]; /* reading BUFSIZE characters, + 1 for NULL */
int ret, rsrc;
if (!pci_sys)
@@ -140,6 +140,8 @@ pci_device_vgaarb_init(void)
if (ret <= 0)
return -1;
+ buf[ret] = 0; /* ret will never be greater than BUFSIZE */
+
memset(&match, 0xff, sizeof(match));
/* need to find the device to go back to and what it was decoding */
rsrc = parse_string_to_decodes_rsrc(buf, &pci_sys->vga_count, &match);
@@ -226,7 +228,7 @@ int
pci_device_vgaarb_set_target(struct pci_device *dev)
{
int len;
- char buf[BUFSIZE];
+ char buf[BUFSIZE + 1]; /* reading BUFSIZE characters, + 1 for NULL */
int ret;
if (!dev)
@@ -245,6 +247,8 @@ pci_device_vgaarb_set_target(struct pci_device *dev)
if (ret <= 0)
return -1;
+ buf[ret] = 0; /* ret will never be greater than BUFSIZE */
+
dev->vgaarb_rsrc = parse_string_to_decodes_rsrc(buf, &pci_sys->vga_count, NULL);
pci_sys->vga_target = dev;
return 0;
@@ -254,7 +258,7 @@ int
pci_device_vgaarb_decodes(int new_vgaarb_rsrc)
{
int len;
- char buf[BUFSIZE];
+ char buf[BUFSIZE + 1]; /* reading BUFSIZE characters, + 1 for NULL */
int ret;
struct pci_device *dev = pci_sys->vga_target;
@@ -272,6 +276,8 @@ pci_device_vgaarb_decodes(int new_vgaarb_rsrc)
if (ret <= 0)
return -1;
+ buf[ret] = 0; /* ret will never be greater than BUFSIZE */
+
parse_string_to_decodes_rsrc(buf, &pci_sys->vga_count, NULL);
return ret;
diff --git a/lib/libpciaccess/src/common_vgaarb_stub.c b/lib/libpciaccess/src/common_vgaarb_stub.c
index 9394273d7..c1708f68a 100644
--- a/lib/libpciaccess/src/common_vgaarb_stub.c
+++ b/lib/libpciaccess/src/common_vgaarb_stub.c
@@ -23,6 +23,9 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include "pciaccess.h"
diff --git a/lib/libpciaccess/src/linux_devmem.c b/lib/libpciaccess/src/linux_devmem.c
index 10e3bde05..0d0567cc6 100644
--- a/lib/libpciaccess/src/linux_devmem.c
+++ b/lib/libpciaccess/src/linux_devmem.c
@@ -32,8 +32,9 @@
*
* \author Ian Romanick <idr@us.ibm.com>
*/
-
-#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libpciaccess/src/linux_sysfs.c b/lib/libpciaccess/src/linux_sysfs.c
index 50d94cf48..a8bc2e197 100644
--- a/lib/libpciaccess/src/linux_sysfs.c
+++ b/lib/libpciaccess/src/linux_sysfs.c
@@ -45,6 +45,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <limits.h>
#include <sys/mman.h>
#include <dirent.h>
#include <errno.h>
@@ -122,7 +123,7 @@ pci_system_linux_sysfs_create( void )
* \param d Directory entry being processed by \c scandir.
*
* \return
- * Zero if the entry name matches either "." or "..", non-zero otherwise.
+ * Zero if the entry name matches either "." or ".."
*
* \sa scandir, populate_entries
*/
@@ -134,6 +135,56 @@ scan_sys_pci_filter( const struct dirent * d )
}
+static int
+parse_separate_sysfs_files(struct pci_device * dev)
+{
+ static const char *attrs[] = {
+ "vendor",
+ "device",
+ "class",
+ "revision",
+ "subsystem_vendor",
+ "subsystem_device",
+ };
+ char name[256];
+ char resource[512];
+ uint64_t data[6];
+ int fd;
+ int i;
+
+ for (i = 0; i < 6; i++) {
+ snprintf(name, 255, "%s/%04x:%02x:%02x.%1u/%s",
+ SYS_BUS_PCI,
+ dev->domain,
+ dev->bus,
+ dev->dev,
+ dev->func,
+ attrs[i]);
+
+ fd = open(name, O_RDONLY | O_CLOEXEC);
+ if (fd == -1) {
+ return errno;
+ }
+
+ read(fd, resource, 512);
+ resource[511] = '\0';
+
+ close(fd);
+
+ data[i] = strtoull(resource, NULL, 16);
+ }
+
+ dev->vendor_id = data[0] & 0xffff;
+ dev->device_id = data[1] & 0xffff;
+ dev->device_class = data[2] & 0xffffff;
+ dev->revision = data[3] & 0xff;
+ dev->subvendor_id = data[4] & 0xffff;
+ dev->subdevice_id = data[5] & 0xffff;
+
+ return 0;
+}
+
+
int
populate_entries( struct pci_system * p )
{
@@ -157,15 +208,28 @@ populate_entries( struct pci_system * p )
(struct pci_device_private *) &p->devices[i];
- sscanf(devices[i]->d_name, "%04x:%02x:%02x.%1u",
+ sscanf(devices[i]->d_name, "%x:%02x:%02x.%1u",
& dom, & bus, & dev, & func);
device->base.domain = dom;
+ /*
+ * Applications compiled with older versions do not expect
+ * 32-bit domain numbers. To keep them working, we keep a 16-bit
+ * version of the domain number at the previous location.
+ */
+ if (dom > 0xffff)
+ device->base.domain_16 = 0xffff;
+ else
+ device->base.domain_16 = dom;
device->base.bus = bus;
device->base.dev = dev;
device->base.func = func;
+ err = parse_separate_sysfs_files(& device->base);
+ if (!err)
+ continue;
+
err = pci_device_linux_sysfs_read(& device->base, config, 0,
48, & bytes);
if ((bytes == 48) && !err) {
@@ -591,8 +655,8 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
/* FIXME: Should we report an error in this case?
*/
fprintf(stderr, "error setting MTRR "
- "(base = 0x%08lx, size = 0x%08x, type = %u) %s (%d)\n",
- sentry.base, sentry.size, sentry.type,
+ "(base = 0x%016" PRIx64 ", size = 0x%08x, type = %u) %s (%d)\n",
+ (pciaddr_t)sentry.base, sentry.size, sentry.type,
strerror(errno), errno);
/* err = errno;*/
}
@@ -666,8 +730,8 @@ pci_device_linux_sysfs_unmap_range(struct pci_device *dev,
/* FIXME: Should we report an error in this case?
*/
fprintf(stderr, "error setting MTRR "
- "(base = 0x%08lx, size = 0x%08x, type = %u) %s (%d)\n",
- sentry.base, sentry.size, sentry.type,
+ "(base = 0x%016" PRIx64 ", size = 0x%08x, type = %u) %s (%d)\n",
+ (pciaddr_t)sentry.base, sentry.size, sentry.type,
strerror(errno), errno);
/* err = errno;*/
}
diff --git a/lib/libpciaccess/src/netbsd_pci.c b/lib/libpciaccess/src/netbsd_pci.c
index f972f945e..1f3bceaca 100644
--- a/lib/libpciaccess/src/netbsd_pci.c
+++ b/lib/libpciaccess/src/netbsd_pci.c
@@ -959,6 +959,10 @@ pci_system_netbsd_create(void)
continue;
device->base.domain = domain;
+ if (domain > 0xffff)
+ device->base.domain_16 = 0xffff;
+ else
+ device->base.domain_16 = domain & 0xffff;
device->base.bus = bus;
device->base.dev = dev;
device->base.func = func;
diff --git a/lib/libpciaccess/src/openbsd_pci.c b/lib/libpciaccess/src/openbsd_pci.c
index 8c084a6a4..1ca98de27 100644
--- a/lib/libpciaccess/src/openbsd_pci.c
+++ b/lib/libpciaccess/src/openbsd_pci.c
@@ -13,6 +13,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -691,6 +694,10 @@ pci_system_openbsd_create(void)
continue;
device->base.domain = domain;
+ if (domain > 0xffff)
+ device->base.domain_16 = 0xffff;
+ else
+ device->base.domain_16 = domain & 0xffff;
device->base.bus = bus;
device->base.dev = dev;
device->base.func = func;
diff --git a/lib/libpciaccess/src/solx_devfs.c b/lib/libpciaccess/src/solx_devfs.c
index f57239304..dc1464d03 100644
--- a/lib/libpciaccess/src/solx_devfs.c
+++ b/lib/libpciaccess/src/solx_devfs.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright IBM Corporation 2006
- * Copyright (c) 2007, 2009, 2011, 2012, 2013 Oracle and/or its affiliates.
+ * Copyright (c) 2007, 2009, 2011, 2012, 2016 Oracle and/or its affiliates.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,6 +25,9 @@
/*
* Solaris devfs interfaces
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <strings.h>
@@ -59,11 +62,10 @@ typedef struct i_devnode {
} i_devnode_t;
typedef struct nexus {
- int fd;
int first_bus;
int last_bus;
int domain;
- char *path; /* for errors/debugging; fd is all we need */
+ char *path; /* for open */
char *dev_path;
struct nexus *next;
} nexus_t;
@@ -143,7 +145,6 @@ pci_system_solx_devfs_destroy( void )
for (nexus = nexus_list ; nexus != NULL ; nexus = next) {
next = nexus->next;
- close(nexus->fd);
free(nexus->path);
free(nexus->dev_path);
free(nexus);
@@ -212,6 +213,11 @@ probe_device_node(di_node_t node, void *arg)
pci_base->dev = PCI_REG_DEV_G(retbuf[0]);
pci_base->func = PCI_REG_FUNC_G(retbuf[0]);
+ if (nexus->domain > 0xffff)
+ pci_base->domain_16 = 0xffff;
+ else
+ pci_base->domain_16 = nexus->domain;
+
/* Get property values */
for (i = 0; i < NUM_PROPERTIES; i++) {
len = di_prop_lookup_ints(DDI_DEV_T_ANY, node,
@@ -296,14 +302,12 @@ probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
int pci_node = 0;
int first_bus = 0, last_bus = PCI_REG_BUS_G(PCI_REG_BUS_M);
int domain = 0;
- di_node_t rnode = DI_NODE_NIL;
#ifdef __sparc
int bus_range_found = 0;
int device_type_found = 0;
di_prom_prop_t prom_prop;
#endif
-
#ifdef DEBUG
nexus_name = di_devfs_minor_path(minor);
fprintf(stderr, "-- device name: %s\n", nexus_name);
@@ -418,33 +422,24 @@ probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
if ((fd = open(nexus_path, O_RDWR | O_CLOEXEC)) >= 0) {
probe_args_t args;
- nexus->fd = fd;
nexus->path = strdup(nexus_path);
nexus_dev_path = di_devfs_path(di_node);
nexus->dev_path = strdup(nexus_dev_path);
di_devfs_path_free(nexus_dev_path);
- if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) {
- (void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
- close(nexus->fd);
- free(nexus->path);
- free(nexus->dev_path);
- free(nexus);
- return (DI_WALK_TERMINATE);
- }
-
/* Walk through devices under the rnode */
args.pinfo = pinfo;
args.nexus = nexus;
args.ret = 0;
- (void) di_walk_node(rnode, DI_WALK_CLDFIRST, (void *)&args, probe_device_node);
+ (void) di_walk_node(di_node, DI_WALK_CLDFIRST, (void *)&args, probe_device_node);
+
+ close(fd);
+
if (args.ret) {
- close(nexus->fd);
free(nexus->path);
free(nexus->dev_path);
free(nexus);
- di_fini(rnode);
return (DI_WALK_TERMINATE);
}
@@ -456,10 +451,6 @@ probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
free(nexus);
}
- if (rnode != DI_NODE_NIL) {
- di_fini(rnode);
- }
-
return DI_WALK_CONTINUE;
}
@@ -552,7 +543,7 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
* starting to find if it is MEM/MEM64/IO
* using libdevinfo
*/
- if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) {
+ if ((rnode = di_init(nexus->dev_path, DINFOCACHE)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
} else {
@@ -787,6 +778,7 @@ pci_device_solx_devfs_read( struct pci_device * dev, void * data,
int err = 0;
unsigned int i = 0;
nexus_t *nexus;
+ int fd;
nexus = find_nexus_for_bus(dev->domain, dev->bus);
@@ -804,11 +796,14 @@ pci_device_solx_devfs_read( struct pci_device * dev, void * data,
cfg_prg.barnum = 0;
cfg_prg.user_version = PCITOOL_USER_VERSION;
+ if ((fd = open(nexus->path, O_RDWR | O_CLOEXEC)) < 0)
+ return ENOENT;
+
for (i = 0; i < size; i += PCITOOL_ACC_ATTR_SIZE(PCITOOL_ACC_ATTR_SIZE_1))
{
cfg_prg.offset = offset + i;
- if ((err = ioctl(nexus->fd, PCITOOL_DEVICE_GET_REG, &cfg_prg)) != 0) {
+ if ((err = ioctl(fd, PCITOOL_DEVICE_GET_REG, &cfg_prg)) != 0) {
fprintf(stderr, "read bdf<%s,%x,%x,%x,%llx> config space failure\n",
nexus->path,
cfg_prg.bus_no,
@@ -826,6 +821,8 @@ pci_device_solx_devfs_read( struct pci_device * dev, void * data,
}
*bytes_read = i;
+ close(fd);
+
return (err);
}
@@ -841,6 +838,7 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
int err = 0;
int cmd;
nexus_t *nexus;
+ int fd;
nexus = find_nexus_for_bus(dev->domain, dev->bus);
@@ -888,11 +886,17 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
*/
cmd = PCITOOL_DEVICE_SET_REG;
- if ((err = ioctl(nexus->fd, cmd, &cfg_prg)) != 0) {
+ if ((fd = open(nexus->path, O_RDWR | O_CLOEXEC)) < 0)
+ return ENOENT;
+
+ if ((err = ioctl(fd, cmd, &cfg_prg)) != 0) {
+ close(fd);
return (err);
}
*bytes_written = size;
+ close(fd);
+
return (err);
}
@@ -1071,7 +1075,7 @@ pci_system_solx_devfs_create( void )
return 0;
}
- if ((di_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) {
+ if ((di_node = di_init("/", DINFOCACHE)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "di_init() failed: %s\n",
strerror(errno));
diff --git a/lib/libpciaccess/src/x86_pci.c b/lib/libpciaccess/src/x86_pci.c
index 49c1cabc3..6b6a0261b 100644
--- a/lib/libpciaccess/src/x86_pci.c
+++ b/lib/libpciaccess/src/x86_pci.c
@@ -18,8 +18,10 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -913,7 +915,7 @@ pci_system_x86_create(void)
if (PCI_VENDOR(reg) == PCI_VENDOR_INVALID ||
PCI_VENDOR(reg) == 0)
continue;
- device->base.domain = 0;
+ device->base.domain = device->base.domain_16 = 0;
device->base.bus = bus;
device->base.dev = dev;
device->base.func = func;