Update to libpciaccess 0.13. Tested by shadchin@

This commit is contained in:
matthieu 2012-03-09 21:02:09 +00:00
parent 2dc64e37e0
commit 37b152092c
37 changed files with 31494 additions and 24566 deletions

View File

@ -1,6 +1,6 @@
(C) Copyright IBM Corporation 2006, 2007
(C) Copyright Eric Anholt 2006
Copyright (c) 2007, 2008, 2009, Oracle and/or its affiliates.
Copyright (c) 2007, 2008, 2009, 2011, Oracle and/or its affiliates.
Copyright 2009 Red Hat, Inc.
All Rights Reserved.

View File

@ -219,6 +219,316 @@ Date: Fri Sep 25 21:19:41 2009 +0200
Merge remote branch 'origin/master' into obsd
commit bf705561d347bc5459bc0af033595c66541cac3e
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat Mar 3 18:19:11 2012 -0800
configure.ac: Bump to 0.13
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit f550c1347d3518874fe1c1d417a57322ee6b52db
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Feb 27 10:43:20 2012 -0500
linux: Don't use /dev/port
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 2a58cd13c3d14cd2ea57826b56e9906ecfc5648a
Author: Mathias Krause <mathias.krause@secunet.com>
Date: Fri Feb 24 09:39:31 2012 +0100
Use correct type for pci_id file accessor functions
This fixes the compiler warning of using the wrong type for gzgets() and
gzclose() as they want a gzFile argument, not a pointer to gzFile. The
abstraction layer pci_id_file should just abstract the full type.
Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 167ffb1c4e431763e30c894131e704bb3599c7c1
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Feb 8 22:14:08 2012 -0800
solx_devfs.c: fix gcc warnings about casting away const when reading data
solx_devfs.c: In function `pci_device_solx_devfs_write':
solx_devfs.c:1085: warning: cast discards qualifiers from pointer target type
solx_devfs.c:1089: warning: cast discards qualifiers from pointer target type
solx_devfs.c:1093: warning: cast discards qualifiers from pointer target type
solx_devfs.c:1097: warning: cast discards qualifiers from pointer target type
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 573b25ecd34dd69ee14c58f752bffdb5709654b9
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Feb 8 22:08:08 2012 -0800
Close pci.ids file when bailing out because realloc failed
Error: File Leak
Leaked File f
at line 272 of src/common_device_name.c in function 'populate_vendor'.
f initialized at line 204 with fopen("/usr/share/hwdata/pci.ids", "r").
[ This bug was found by the Parfait 0.5.0 bug checking tool.
For more information see http://labs.oracle.com/projects/parfait/ ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ed6c6157bc94283ce0a8526eeff668094cf3992d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Feb 8 21:40:54 2012 -0800
Solaris: reorder functions to remove need for lots of static prototypes
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b56f9a84f3dff995a6901ffec6bcc161ec0245ad
Author: Mark Kettenis <kettenis@openbsd.org>
Date: Thu Dec 29 21:14:44 2011 +0100
OpenBSD: Implement map_legacy and legacy_io
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Matthieu Herrb <matthieu.herrb@laas.fr>
commit a798395a1bfd9d06d40e2d8d14377a156c94429a
Author: Daniel Drake <dsd@laptop.org>
Date: Fri Nov 25 12:28:48 2011 -0600
delete_io_handle: fix deletion of last handle
When num_ios goes from 1 to 0, a realloc(ios, 0); call is made.
This is equivalent to free(ios) and NULL is returned.
However, the previous logic in the code incorrectly discards this NULL
return value. When we next call new_io_handle(), realloc(ios, X) is
called with "ios" pointing to freed memory. This causes glibc to abort.
Correct this logic to detect the 1-to-0 case and handle it correctly.
Other cases are unchanged; there is still value in checking the
return value from realloc() as it also returns NULL on error.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 2601ddd02d608c16b0022fe342e0a3f4bf6cadeb
Author: Mark Kettenis <mark.kettenis@xs4all.nl>
Date: Sun Nov 6 17:34:29 2011 +0000
Add VGA Arbiter support for OpenBSD.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
commit e64ee4ee2b23dba147d144aacead3cb61c744854
Author: Mark Kettenis <mark.kettenis@xs4all.nl>
Date: Sun Nov 6 17:32:51 2011 +0000
OpenBSD: Indicate that devices need access to legacy VGA resources.
Makes sure xserver disables DRI if the VGA arbiter is in use.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
commit cfae4096835fe569edb03cd12d4580fc912a0e61
Author: Henry Zhao <henry.zhao@oracle.com>
Date: Mon Nov 14 18:53:21 2011 -0800
Solaris: improve support for sparc platform
(1) added prom property retrieval on sparc
(2) added multiple domain support on sparc
(3) use kernel device as mapping device
(4) performance improvements by removing redundant ioctl
Signed-off-by: Henry Zhao <henry.zhao@oracle.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 78eed07d599ff9e30c075aa7c8d1795e125ffc4b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Nov 9 09:27:49 2011 -0800
configure.ac: Bump to 0.12.902
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit cbb3c63affc1792ade0433691aa67f0edad52b0b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Nov 9 09:46:30 2011 -0800
Fix some -Wformat errors in scanpci
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit a0a53a67c91c698007dcac3e7aba27c999c4f6ed
Author: Nithin Nayak Sujir <nsujir@broadcom.com>
Date: Mon Oct 24 12:15:15 2011 -0700
libpciaccess: close mtrr fd on pci_cleanup
Since the fd is not closed, calling pci_system_init and
pci_system_cleanup more than 1024 times results in "too many files open"
error.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 803bf3aa28de0f1260e479e2036159d4fead0a87
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Oct 4 21:46:05 2011 -0700
Solaris: Give better error on realloc failure
commit a18460b385ae03 converted from a fixed maximum number of devices
to dynamically growing the list via realloc, but didn't update the
error message shown on failure.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
commit af4478c52c960bee08209293aa14b784ac30dc05
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Tue Oct 11 10:22:49 2011 -0700
linux sysfs: Fix read-write access in map_legacy
O_RDONLY | O_WRONLY != O_RDWR
><
Reported-by: Javier Pello <javier.pello@urjc.es>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit b9c5ce8083be53ea017bd15a63b173b4476fff23
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sun Oct 9 03:53:05 2011 -0700
scanpci: Build fix for systems without <err.h>
https://bugs.freedesktop.org/show_bug.cgi?id=31133
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 30e9ec91107791835d722f99498d659dec048922
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Oct 7 11:57:26 2011 -0700
configure.ac: Bump version to 0.12.901
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 12dbf6d2d346cfe7ba8b2a1697c56af3f9876be7
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Oct 7 11:56:06 2011 -0700
Update library version to reflect new API
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 58e87933b3286f33cdeedd3a6b21f4ea795bea47
Author: Adam Jackson <ajax@redhat.com>
Date: Tue May 10 17:56:35 2011 -0400
linux: Implement map_legacy
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 8cc9a8fe57adfb52abaa90a8a2ac2316de8eb898
Author: Adam Jackson <ajax@redhat.com>
Date: Tue May 10 17:56:34 2011 -0400
Add map_legacy interface
This allows platforms to hand back mmaps of the low 1M (ISA) address
space on a per-domain basis.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit e1a0240a3d6840b497845680c2bf6753415ba20f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 16 22:11:38 2011 -0700
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7bfc4f806d51b85e7ae069dd6deaf0b48326ed22
Author: Adam Jackson <ajax@redhat.com>
Date: Wed Aug 3 18:35:11 2011 -0400
linux: Fix a crash in populate_devices
If scandir returns -1, the 'devices' array won't be initialized, and
attempting to free() it will crash.
Signed-off-by: Adam Jackson <ajax@redhat.com>
commit f9159b97834ba4b4e42a07953a33866e7ac90dbd
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sat Jun 4 12:30:06 2011 +0100
linux: Only set errno after an error
errno is only valid after an error, and was being filled with a garbage
value upon eof.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
commit a18460b385ae034830e4efbaaed7e0665c53ad9f
Author: John Martin <John.M.Martin@Oracle.COM>
Date: Mon Mar 28 17:51:19 2011 -0700
Solaris support for multiple PCI segments (domains)
1. Removed hardcoded maximum size of 256 PCI devices, which is
too small for large systems. The number of devices is dynamically
resized as needed.
2. pci_device_solx_devfs_probe() no longer walks the device tree
from the very top ("/") but instead starts at the nexus which
owns the bus. Performance optimization for systems with multiple
bus nodes (including systems with just one segment/domain).
3. Added support for multiple domains/segments. Code tested
on kernels with and without multiple segment support so it should
be safe to integrate independent of the kernel version.
Signed-off-by: John Martin <John.M.Martin@Oracle.COM>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
commit f3e283a25f5fca4f750bb9538d69c4f36641cca5
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Thu Feb 3 17:38:32 2011 -0500
config: comment, minor upgrade, quote and layout configure.ac
Group statements per section as per Autoconf standard layout
Quote statements where appropriate.
Autoconf recommends not using dnl instead of # for comments
Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters.
Add AC_CONFIG_SRCDIR([Makefile.am])
Update X.Org util-macros to version 1.8
This helps automated maintenance and release activities.
Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit d05ed57216726811388f17d7e87d7b6c7b8580ee
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Feb 2 20:50:17 2011 -0800

View File

@ -1,4 +1,4 @@
#
#
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#

View File

@ -1,6 +1,6 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2010/07/10 18:56:27 matthieu Exp $
# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2012/03/09 21:02:09 matthieu Exp $
SHARED_LIBS= pciaccess 1.0
SHARED_LIBS= pciaccess 1.1
CONFIGURE_ARGS+= --with-pciids-path=${X11BASE}/share

View File

@ -14,7 +14,7 @@
@SET_MAKE@
#
#
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#
@ -67,7 +67,9 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@ -120,6 +122,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -127,24 +130,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FREEBSD_FALSE = @FREEBSD_FALSE@
@ -157,6 +156,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -165,21 +165,27 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_FALSE = @LINUX_FALSE@
LINUX_TRUE = @LINUX_TRUE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NETBSD_FALSE = @NETBSD_FALSE@
NETBSD_TRUE = @NETBSD_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENBSD_FALSE = @OPENBSD_FALSE@
OPENBSD_TRUE = @OPENBSD_TRUE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -201,13 +207,11 @@ STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@ -42,6 +45,10 @@
/* Linux ROM read fallback */
#undef LINUX_ROM
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,29 @@
dnl (C) Copyright IBM Corporation 2006
dnl 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"),
dnl to deal in the Software without restriction, including without limitation
dnl on the rights to use, copy, modify, merge, publish, distribute, sub
dnl license, and/or sell copies of the Software, and to permit persons to whom
dnl the Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice (including the next
dnl paragraph) shall be included in all copies or substantial portions of the
dnl Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
dnl IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
# IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([libpciaccess],[0.12.1],
AC_INIT([libpciaccess],[0.13],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
@ -33,15 +32,15 @@ AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require xorg-macros: XORG_DEFAULT_OPTIONS
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.3)
XORG_DEFAULT_OPTIONS
# Check for progs
# Initialize libtool
AC_PROG_LIBTOOL
# Require X.Org macros 1.8 or later
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
pciids_path=/usr/share/hwdata
AC_ARG_WITH(pciids-path, AS_HELP_STRING([--with-pciids-path=PCIIDS_PATH],
[Path to pci.ids file]), [pciids_path="$withval"])
@ -107,13 +106,15 @@ AM_CONDITIONAL(GNU, [test "x$gnu" = xyes])
AC_SYS_LARGEFILE
AC_CHECK_HEADERS([err.h])
AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
if test "x$have_mtrr_h" = xyes; then
AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
fi
dnl check for the pci_io.pi_sel.pc_domain
# check for the pci_io.pi_sel.pc_domain
AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
[AC_DEFINE(HAVE_PCI_IO_PC_DOMAIN,1,[Have the pci_io.pi_sel.pc_domain member.])],
[],
@ -123,12 +124,11 @@ AC_CHECK_MEMBER([struct pci_io.pi_sel.pc_domain],
AC_SUBST(PCIACCESS_CFLAGS)
AC_SUBST(PCIACCESS_LIBS)
AC_CONFIG_FILES([Makefile
include/Makefile
man/Makefile
src/Makefile
scanpci/Makefile
pciaccess.pc])
include/Makefile
man/Makefile
src/Makefile
scanpci/Makefile
pciaccess.pc])
AC_OUTPUT

View File

@ -41,7 +41,9 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@ -75,6 +77,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -82,24 +85,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FREEBSD_FALSE = @FREEBSD_FALSE@
@ -112,6 +111,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -120,21 +120,27 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_FALSE = @LINUX_FALSE@
LINUX_TRUE = @LINUX_TRUE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NETBSD_FALSE = @NETBSD_FALSE@
NETBSD_TRUE = @NETBSD_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENBSD_FALSE = @OPENBSD_FALSE@
OPENBSD_TRUE = @OPENBSD_TRUE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -156,13 +162,11 @@ STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@

View File

@ -50,7 +50,7 @@
/**
* \file pciaccess.h
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/
@ -62,7 +62,7 @@
#if __GNUC__ >= 3
#define __deprecated __attribute__((deprecated))
#else
#define __deprecated
#define __deprecated
#endif
typedef uint64_t pciaddr_t;
@ -193,7 +193,7 @@ int pci_device_cfg_write_bits(struct pci_device *dev, uint32_t mask,
struct pci_id_match {
/**
* \name Device / vendor matching controls
*
*
* Control the search based on the device, vendor, subdevice, or subvendor
* IDs. Setting any of these fields to \c PCI_MATCH_ANY will cause the
* field to not be used in the comparison.
@ -208,7 +208,7 @@ struct pci_id_match {
/**
* \name Device class matching controls
*
*
*/
/*@{*/
uint32_t device_class;
@ -261,7 +261,7 @@ struct pci_mem_region {
* This address is really only useful to other devices in the same
* domain. It's probably \b not the address applications will ever
* use.
*
*
* \warning
* Most (all?) platform back-ends leave this field unset.
*/
@ -270,7 +270,7 @@ struct pci_mem_region {
/**
* Base physical address of the region from the CPU's point of view.
*
*
* This address is typically passed to \c pci_device_map_range to create
* a mapping of the region to the CPU's virtual address space.
*/
@ -468,7 +468,7 @@ struct pci_pcmcia_bridge_info {
uint8_t card_bus;
uint8_t subordinate_bus;
uint8_t cardbus_latency_timer;
uint16_t secondary_status;
uint16_t bridge_control;
@ -526,4 +526,12 @@ void pci_io_write32(struct pci_io_handle *handle, uint32_t reg, uint32_t data);
void pci_io_write16(struct pci_io_handle *handle, uint32_t reg, uint16_t data);
void pci_io_write8(struct pci_io_handle *handle, uint32_t reg, uint8_t data);
/*
* Legacy memory access
*/
int pci_device_map_legacy(struct pci_device *dev, pciaddr_t base,
pciaddr_t size, unsigned map_flags, void **addr);
int pci_device_unmap_legacy(struct pci_device *dev, void *addr, pciaddr_t size);
#endif /* PCIACCESS_H */

File diff suppressed because it is too large Load Diff

7982
lib/libpciaccess/m4/libtool.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

384
lib/libpciaccess/m4/ltoptions.m4 vendored Normal file
View File

@ -0,0 +1,384 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 7 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])

123
lib/libpciaccess/m4/ltsugar.m4 vendored Normal file
View File

@ -0,0 +1,123 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])

23
lib/libpciaccess/m4/ltversion.m4 vendored Normal file
View File

@ -0,0 +1,23 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 3337 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.2])
m4_define([LT_PACKAGE_REVISION], [1.3337])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.2'
macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

98
lib/libpciaccess/m4/lt~obsolete.m4 vendored Normal file
View File

@ -0,0 +1,98 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])

View File

@ -63,7 +63,9 @@ subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@ -87,6 +89,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -94,24 +97,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FREEBSD_FALSE = @FREEBSD_FALSE@
@ -124,6 +123,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -132,21 +132,27 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_FALSE = @LINUX_FALSE@
LINUX_TRUE = @LINUX_TRUE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NETBSD_FALSE = @NETBSD_FALSE@
NETBSD_TRUE = @NETBSD_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENBSD_FALSE = @OPENBSD_FALSE@
OPENBSD_TRUE = @OPENBSD_TRUE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -168,13 +174,11 @@ STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@

View File

@ -64,7 +64,9 @@ subdir = scanpci
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@ -105,6 +107,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -112,24 +115,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FREEBSD_FALSE = @FREEBSD_FALSE@
@ -142,6 +141,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -150,21 +150,27 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_FALSE = @LINUX_FALSE@
LINUX_TRUE = @LINUX_TRUE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NETBSD_FALSE = @NETBSD_FALSE@
NETBSD_TRUE = @NETBSD_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENBSD_FALSE = @OPENBSD_FALSE@
OPENBSD_TRUE = @OPENBSD_TRUE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -186,13 +192,11 @@ STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@

View File

@ -22,10 +22,29 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <unistd.h>
#include <inttypes.h>
#ifdef HAVE_ERR_H
#include <err.h>
#else
# include <errno.h>
# include <string.h>
# define err(exitcode, format, args...) \
errx(exitcode, format ": %s", ## args, strerror(errno))
# define errx(exitcode, format, args...) \
{ warnx(format, ## args); exit(exitcode); }
# define warn(format, args...) \
warnx(format ": %s", ## args, strerror(errno))
# define warnx(format, args...) \
fprintf(stderr, format "\n", ## args)
#endif
#include "pciaccess.h"
@ -33,19 +52,19 @@
static void
print_pci_bridge( const struct pci_bridge_info * info )
{
printf( " Bus: primary=%02x, secondary=%02x, subordinate=%02x, "
"sec-latency=%u\n",
printf( " Bus: primary=%02"PRIx8", secondary=%02"PRIx8", subordinate=%02"PRIx8", "
"sec-latency=%"PRIu8"\n",
info->primary_bus,
info->secondary_bus,
info->subordinate_bus,
info->secondary_latency_timer );
printf( " I/O behind bridge: %08x-%08x\n",
printf( " I/O behind bridge: %08"PRIx32"-%08"PRIx32"\n",
info->io_base,
info->io_limit );
printf( " Memory behind bridge: %08x-%08x\n",
printf( " Memory behind bridge: %08"PRIx32"-%08"PRIx32"\n",
info->mem_base,
info->mem_limit );
printf( " Prefetchable memory behind bridge: %08llx-%08llx\n",
printf( " Prefetchable memory behind bridge: %08"PRIx64"-%08"PRIx64"\n",
info->prefetch_mem_base,
info->prefetch_mem_limit );
}
@ -132,7 +151,7 @@ print_pci_device( struct pci_device * dev, int verbose )
pci_device_probe( dev );
for ( i = 0 ; i < 6 ; i++ ) {
if ( dev->regions[i].base_addr != 0 ) {
printf( " BASE%u 0x%08x SIZE %d %s",
printf( " BASE%u 0x%08"PRIxPTR" SIZE %zu %s",
i,
(intptr_t) dev->regions[i].base_addr,
(size_t) dev->regions[i].size,

View File

@ -1,4 +1,4 @@
#
#
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#
@ -43,6 +43,7 @@ endif
if OPENBSD
OS_SUPPORT = openbsd_pci.c
# VGA Arbiter code is included in openbsd_pci.c
endif
if SOLARIS
@ -69,4 +70,4 @@ libpciaccess_la_SOURCES = common_bridge.c \
libpciaccess_la_LIBADD = $(PCIACCESS_LIBS)
libpciaccess_la_LDFLAGS = -version-number 0:10:8 -no-undefined
libpciaccess_la_LDFLAGS = -version-number 0:11:0 -no-undefined

View File

@ -14,7 +14,7 @@
@SET_MAKE@
#
#
# (C) Copyright IBM Corporation 2006
# All Rights Reserved.
#
@ -63,7 +63,9 @@ subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@ -135,6 +137,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -142,24 +145,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FREEBSD_FALSE = @FREEBSD_FALSE@
@ -172,6 +171,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -180,21 +180,27 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_FALSE = @LINUX_FALSE@
LINUX_TRUE = @LINUX_TRUE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NETBSD_FALSE = @NETBSD_FALSE@
NETBSD_TRUE = @NETBSD_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENBSD_FALSE = @OPENBSD_FALSE@
OPENBSD_TRUE = @OPENBSD_TRUE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -216,13 +222,11 @@ STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@ -271,6 +275,7 @@ lib_LTLIBRARIES = libpciaccess.la
@LINUX_TRUE@OS_SUPPORT = linux_sysfs.c linux_devmem.c linux_devmem.h
@NETBSD_TRUE@OS_SUPPORT = netbsd_pci.c
@OPENBSD_TRUE@OS_SUPPORT = openbsd_pci.c
# VGA Arbiter code is included in openbsd_pci.c
@SOLARIS_TRUE@OS_SUPPORT = solx_devfs.c pci_tools.h
@FREEBSD_TRUE@VGA_ARBITER = common_vgaarb_stub.c
@GNU_TRUE@VGA_ARBITER = common_vgaarb_stub.c
@ -290,7 +295,7 @@ libpciaccess_la_SOURCES = common_bridge.c \
$(OS_SUPPORT)
libpciaccess_la_LIBADD = $(PCIACCESS_LIBS)
libpciaccess_la_LDFLAGS = -version-number 0:10:8 -no-undefined
libpciaccess_la_LDFLAGS = -version-number 0:11:0 -no-undefined
all: all-am
.SUFFIXES:

View File

@ -25,7 +25,7 @@
/**
* \file common_bridge.c
* Support routines used to process PCI header information for bridges.
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/
@ -75,7 +75,7 @@ read_bridge_info( struct pci_device_private * priv )
info = malloc(sizeof(*info));
if (info != NULL) {
pci_device_cfg_read( (struct pci_device *) priv, buf + 0x18, 0x18,
pci_device_cfg_read( (struct pci_device *) priv, buf + 0x18, 0x18,
0x40 - 0x18, & bytes );
info->primary_bus = buf[0x18];
@ -239,7 +239,7 @@ pci_device_get_pcmcia_bridge_info( struct pci_device * dev )
/**
* Determine the primary, secondary, and subordinate buses for a bridge
*
*
* Determines the IDs of the primary, secondary, and subordinate buses for
* a specified bridge. Not all bridges directly store this information
* (e.g., PCI-to-ISA bridges). For those bridges, no error is returned, but
@ -252,7 +252,7 @@ pci_device_get_pcmcia_bridge_info( struct pci_device * dev )
* \return
* On success, zero is returned. If \c dev is not a bridge, \c ENODEV is
* returned.
*
*
* \bug
* Host bridges are handled the same way as PCI-to-ISA bridges. This is
* almost certainly not correct.
@ -265,7 +265,7 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus,
/* If the device isn't a bridge, return an error.
*/
if (((dev->device_class >> 16) & 0x0ff) != 0x06) {
return ENODEV;
}

View File

@ -25,7 +25,7 @@
/**
* \file common_capability.c
* Platform independent PCI capability related routines.
*
*
* In addition to including the interface glue for \c pci_device_get_agp_info,
* this file also contains a generic implementation of that function.
*
@ -51,7 +51,7 @@
* Once more than just the AGP capability is supported, the body of each of
* the cases in the capability processing loop should probably be broken out
* into its own function.
*
*
* \todo
* Once more than just the AGP capability is supported, some care will need
* to be taken in partial failure cases. If, say, the first capability is
@ -79,7 +79,7 @@ pci_fill_capabilities_generic( struct pci_device * dev )
if ( (status & 0x0010) == 0 ) {
return ENOSYS;
}
err = pci_device_cfg_read_u8( dev, & cap_offset, 52 );
if ( err ) {
return err;
@ -101,7 +101,7 @@ pci_fill_capabilities_generic( struct pci_device * dev )
if ( err ) {
return err;
}
switch ( cap_id ) {
case 2: {
struct pci_agp_info * agp_info;
@ -187,7 +187,7 @@ pci_device_get_agp_info( struct pci_device * dev )
if ( dev == NULL ) {
return NULL;
}
if ( dev_priv->agp == NULL ) {
(void) (*pci_sys->methods->fill_capabilities)( dev );
}

View File

@ -69,7 +69,7 @@ pci_id_file_open(void)
#define pci_id_file_gets(l, s, f) gzgets(f, l, s)
#define pci_id_file_close(f) gzclose(f)
#else
typedef FILE pci_id_file;
typedef FILE * pci_id_file;
#define pci_id_file_open() fopen(PCIIDS_PATH "/pci.ids", "r")
#define pci_id_file_gets(l, s, f) fgets(l, s, f)
#define pci_id_file_close(f) fclose(f)
@ -77,7 +77,7 @@ typedef FILE pci_id_file;
/**
* Node for sorting vendor IDs.
*
*
* Each structure forms an internal node of an n-way tree. Each node selects
* \c pci_id_node::bits number of bits from the vendor ID. Starting from the
* root of the tree, a slice of the low-order bits of the vendor ID are
@ -86,7 +86,7 @@ typedef FILE pci_id_file;
* At the leaf nodes (i.e., the node entered when all 16 bits of the vendor ID
* have been used), the \c pci_id_node::children is actually an array of
* pointers to \c pci_id_leaf structures.
*
*
* \todo
* Determine if there is a cleaner way (in the source code) to have the
* \c children array change type based on whether the node is internal or
@ -105,7 +105,7 @@ struct pci_id_node {
struct pci_id_leaf {
uint16_t vendor;
const char * vendor_name;
size_t num_devices;
struct pci_device_leaf * devices;
};
@ -122,7 +122,7 @@ _pci_hidden struct pci_id_node * tree = NULL;
/**
* Get a pointer to the leaf node for a vendor ID.
*
*
* If the vendor ID does not exist in the tree, it is added.
*/
static struct pci_id_leaf *
@ -159,7 +159,7 @@ insert( uint16_t vendor )
n->children[ idx ] = child;
}
else {
struct pci_id_leaf * leaf =
struct pci_id_leaf * leaf =
calloc( 1, sizeof( struct pci_id_leaf ) );
leaf->vendor = vendor;
@ -177,9 +177,9 @@ insert( uint16_t vendor )
/**
* Populate a vendor node with all the devices associated with that vendor
*
*
* \param vend Vendor node that is to be filled from the pci.ids file.
*
*
* \todo
* The parsing in this function should be more rhobust. There are some error
* cases (i.e., a 0-tab line followed by a 2-tab line) that aren't handled
@ -189,7 +189,7 @@ insert( uint16_t vendor )
static void
populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
{
pci_id_file * f;
pci_id_file f;
char buf[128];
unsigned vendor = PCI_MATCH_ANY;
@ -202,7 +202,7 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
}
f = pci_id_file_open();
/* If the pci.ids file could not be opened, there's nothing we can do.
*/
if (f == NULL) {
@ -223,14 +223,14 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
break;
}
}
if ( !isxdigit( buf[ num_tabs + 0 ] )
|| !isxdigit( buf[ num_tabs + 1 ] )
|| !isxdigit( buf[ num_tabs + 2 ] )
|| !isxdigit( buf[ num_tabs + 3 ] ) ) {
continue;
}
new_line = strchr( buf, '\n' );
if ( new_line != NULL ) {
*new_line = '\0';
@ -263,13 +263,13 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
struct pci_device_leaf * d;
struct pci_device_leaf * dev;
struct pci_device_leaf * last_dev;
d = realloc( vend->devices, (vend->num_devices + 1)
* sizeof( struct pci_device_leaf ) );
if ( d == NULL ) {
return;
goto cleanup;
}
last_dev = & d[ vend->num_devices - 1 ];
@ -279,7 +279,7 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
if ( num_tabs == 1 ) {
dev->id.vendor_id = vend->vendor;
dev->id.device_id = (unsigned) strtoul( & buf[ num_tabs ],
dev->id.device_id = (unsigned) strtoul( & buf[ num_tabs ],
NULL, 16 );
dev->id.subvendor_id = PCI_MATCH_ANY;
dev->id.subdevice_id = PCI_MATCH_ANY;
@ -295,13 +295,14 @@ populate_vendor( struct pci_id_leaf * vend, int fill_device_data )
dev->id.subvendor_id= (unsigned) strtoul( & buf[ num_tabs ],
NULL, 16 );
dev->id.subdevice_id = (unsigned) strtoul( & buf[ num_tabs + 5 ],
dev->id.subdevice_id = (unsigned) strtoul( & buf[ num_tabs + 5 ],
NULL, 16 );
dev->device_name = strdup( & buf[ num_tabs + 5 + 6 ] );
}
}
}
cleanup:
pci_id_file_close( f );
}

View File

@ -39,7 +39,7 @@ _pci_hidden struct pci_system * pci_sys;
/**
* Initialize the PCI subsystem for access.
*
*
* \return
* Zero on success or an errno value on failure. In particular, if no
* platform-specific initializers are available, \c ENOSYS will be returned.
@ -51,7 +51,7 @@ int
pci_system_init( void )
{
int err = ENOSYS;
#ifdef linux
err = pci_system_linux_sysfs_create();
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@ -79,7 +79,7 @@ pci_system_init_dev_mem(int fd)
/**
* Shutdown all access to the PCI subsystem.
*
*
* \sa pci_system_init
*/
void
@ -103,7 +103,7 @@ pci_system_cleanup( void )
free( (char *) pci_sys->devices[i].device_string );
free( (char *) pci_sys->devices[i].agp );
pci_sys->devices[i].device_string = NULL;
pci_sys->devices[i].agp = NULL;
@ -111,7 +111,7 @@ pci_system_cleanup( void )
(*pci_sys->methods->destroy_device)( & pci_sys->devices[i].base );
}
}
free( pci_sys->devices );
pci_sys->devices = NULL;
pci_sys->num_devices = 0;
@ -121,7 +121,7 @@ pci_system_cleanup( void )
if ( pci_sys->methods->destroy != NULL ) {
(*pci_sys->methods->destroy)();
}
free( pci_sys );
pci_sys = NULL;
}

View File

@ -86,14 +86,14 @@
/**
* Read a device's expansion ROM.
*
*
* Reads the device's expansion ROM and stores the data in the memory pointed
* to by \c buffer. The buffer must be at least \c pci_device::rom_size
* bytes.
*
* \param dev Device whose expansion ROM is to be read.
* \param buffer Memory in which to store the ROM.
*
*
* \return
* Zero on success or an \c errno value on failure.
*/
@ -125,7 +125,7 @@ pci_device_is_boot_vga( struct pci_device * dev )
/**
* Probe a PCI device to determine if a kernel driver is attached.
*
*
* \param dev Device to query
* \return
* Zero if no driver attached, 1 if attached kernel drviver
@ -140,14 +140,14 @@ pci_device_has_kernel_driver( struct pci_device * dev )
/**
* Probe a PCI device to learn information about the device.
*
*
* Probes a PCI device to learn various information about the device. Before
* calling this function, the only public fields in the \c pci_device
* structure that have valid values are \c pci_device::domain,
* \c pci_device::bus, \c pci_device::dev, and \c pci_device::func.
*
*
* \param dev Device to be probed.
*
*
* \return
* Zero on success or an \c errno value on failure.
*/
@ -173,7 +173,7 @@ pci_device_probe( struct pci_device * dev )
* \param dev Device whose memory region is to be mapped.
* \param region Region, on the range [0, 5], that is to be mapped.
* \param write_enable Map for writing (non-zero).
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -194,7 +194,7 @@ pci_device_map_region(struct pci_device * dev, unsigned region,
if (dev->regions[region].memory != NULL) {
return 0;
}
return pci_device_map_range(dev, dev->regions[region].base_addr,
dev->regions[region].size, map_flags,
&dev->regions[region].memory);
@ -213,7 +213,7 @@ pci_device_map_region(struct pci_device * dev, unsigned region,
* \param size Size of the range to be mapped.
* \param write_enable Map for writing (non-zero).
* \param addr Location to store the mapped address.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -241,7 +241,7 @@ int pci_device_map_memory_range(struct pci_device *dev,
* \param size Size of the range to be mapped.
* \param map_flags Flag bits controlling how the mapping is accessed.
* \param addr Location to store the mapped address.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -335,7 +335,7 @@ pci_device_map_range(struct pci_device *dev, pciaddr_t base,
*
* \param dev Device whose memory region is to be mapped.
* \param region Region, on the range [0, 5], that is to be mapped.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -374,7 +374,7 @@ pci_device_unmap_region( struct pci_device * dev, unsigned region )
* \param dev Device whose memory is to be unmapped.
* \param memory Pointer to the base of the mapped range.
* \param size Size, in bytes, of the range to be unmapped.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -398,7 +398,7 @@ pci_device_unmap_memory_range(struct pci_device *dev, void *memory,
* \param dev Device whose memory is to be unmapped.
* \param memory Pointer to the base of the mapped range.
* \param size Size, in bytes, of the range to be unmapped.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -429,17 +429,17 @@ pci_device_unmap_range(struct pci_device *dev, void *memory,
return ENOENT;
}
err = (*pci_sys->methods->unmap_range)(dev, &devp->mappings[i]);
if (!err) {
const unsigned entries_to_move = (devp->num_mappings - i) - 1;
if (entries_to_move > 0) {
(void) memmove(&devp->mappings[i],
&devp->mappings[i + 1],
entries_to_move * sizeof(devp->mappings[0]));
}
devp->num_mappings--;
devp->mappings = realloc(devp->mappings,
(sizeof(devp->mappings[0]) * devp->num_mappings));
@ -474,7 +474,7 @@ pci_device_unmap_range(struct pci_device *dev, void *memory,
*/
int
pci_device_cfg_read( struct pci_device * dev, void * data,
pciaddr_t offset, pciaddr_t size,
pciaddr_t offset, pciaddr_t size,
pciaddr_t * bytes_read )
{
pciaddr_t scratch;
@ -484,7 +484,7 @@ pci_device_cfg_read( struct pci_device * dev, void * data,
}
return pci_sys->methods->read( dev, data, offset, size,
(bytes_read == NULL)
(bytes_read == NULL)
? & scratch : bytes_read );
}
@ -495,7 +495,7 @@ pci_device_cfg_read_u8( struct pci_device * dev, uint8_t * data,
{
pciaddr_t bytes;
int err = pci_device_cfg_read( dev, data, offset, 1, & bytes );
if ( (err == 0) && (bytes != 1) ) {
err = ENXIO;
}
@ -510,7 +510,7 @@ pci_device_cfg_read_u16( struct pci_device * dev, uint16_t * data,
{
pciaddr_t bytes;
int err = pci_device_cfg_read( dev, data, offset, 2, & bytes );
if ( (err == 0) && (bytes != 2) ) {
err = ENXIO;
}
@ -561,7 +561,7 @@ pci_device_cfg_read_u32( struct pci_device * dev, uint32_t * data,
*/
int
pci_device_cfg_write( struct pci_device * dev, const void * data,
pciaddr_t offset, pciaddr_t size,
pciaddr_t offset, pciaddr_t size,
pciaddr_t * bytes_written )
{
pciaddr_t scratch;
@ -571,7 +571,7 @@ pci_device_cfg_write( struct pci_device * dev, const void * data,
}
return pci_sys->methods->write( dev, data, offset, size,
(bytes_written == NULL)
(bytes_written == NULL)
? & scratch : bytes_written );
}
@ -590,7 +590,7 @@ pci_device_cfg_write_u8(struct pci_device *dev, uint8_t data,
return err;
}
int
pci_device_cfg_write_u16(struct pci_device *dev, uint16_t data,
@ -627,7 +627,7 @@ pci_device_cfg_write_u32(struct pci_device *dev, uint32_t data,
int
pci_device_cfg_write_bits( struct pci_device * dev, uint32_t mask,
pci_device_cfg_write_bits( struct pci_device * dev, uint32_t mask,
uint32_t data, pciaddr_t offset )
{
uint32_t temp;
@ -654,3 +654,47 @@ pci_device_enable(struct pci_device *dev)
if (pci_sys->methods->enable)
pci_sys->methods->enable(dev);
}
/**
* Map the legacy memory space for the PCI domain containing \c dev.
*
* \param dev Device whose memory region is to be mapped.
* \param base Base address of the range to be mapped.
* \param size Size of the range to be mapped.
* \param map_flags Flag bits controlling how the mapping is accessed.
* \param addr Location to store the mapped address.
*
* \returns
* Zero on success or an \c errno value on failure.
*/
int
pci_device_map_legacy(struct pci_device *dev, pciaddr_t base, pciaddr_t size,
unsigned map_flags, void **addr)
{
if (base > 0x100000 || base + size > 0x100000)
return EINVAL;
if (!pci_sys->methods->map_legacy)
return ENOSYS;
return pci_sys->methods->map_legacy(dev, base, size, map_flags, addr);
}
/**
* Unmap the legacy memory space for the PCI domain containing \c dev.
*
* \param dev Device whose memory region is to be unmapped.
* \param addr Location of the mapped address.
* \param size Size of the range to be unmapped.
*
* \returns
* Zero on success or an \c errno value on failure.
*/
int
pci_device_unmap_legacy(struct pci_device *dev, void *addr, pciaddr_t size)
{
if (!pci_sys->methods->unmap_legacy)
return ENOSYS;
return pci_sys->methods->unmap_legacy(dev, addr, size);
}

View File

@ -64,10 +64,15 @@ delete_io_handle(struct pci_io_handle *handle)
}
}
new = realloc(ios, sizeof(struct pci_io_handle) * (num_ios - 1));
if (new)
ios = new;
num_ios--;
if (num_ios) {
new = realloc(ios, sizeof(struct pci_io_handle) * num_ios);
if (new)
ios = new;
} else {
free(ios);
ios = NULL;
}
}
_pci_hidden void
@ -109,7 +114,7 @@ pci_device_open_io(struct pci_device *dev, pciaddr_t base, pciaddr_t size)
ret = new_io_handle();
if (!ret)
return NULL;
if (!pci_sys->methods->open_device_io(ret, dev, bar, base, size)) {
delete_io_handle(ret);
return NULL;

View File

@ -25,7 +25,7 @@
/**
* \file common_iterator.c
* Platform independent iterator support routines.
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/
@ -37,7 +37,7 @@
/**
* Track device iteration state
*
*
* \private
*/
struct pci_device_iterator {
@ -69,7 +69,7 @@ struct pci_device_iterator *
pci_slot_match_iterator_create( const struct pci_slot_match * match )
{
struct pci_device_iterator * iter;
if ( pci_sys == NULL ) {
return NULL;
}
@ -105,7 +105,7 @@ struct pci_device_iterator *
pci_id_match_iterator_create( const struct pci_id_match * match )
{
struct pci_device_iterator * iter;
if ( pci_sys == NULL ) {
return NULL;
}
@ -130,9 +130,9 @@ pci_id_match_iterator_create( const struct pci_id_match * match )
/**
* Destroy an iterator previously created with \c pci_iterator_create.
*
*
* \param iter Iterator to be destroyed.
*
*
* \sa pci_device_next, pci_iterator_create
*/
void
@ -146,9 +146,9 @@ pci_iterator_destroy( struct pci_device_iterator * iter )
/**
* Iterate to the next PCI device.
*
*
* \param iter Device iterator returned by \c pci_device_iterate.
*
*
* \return
* A pointer to a \c pci_device, or \c NULL when all devices have been
* iterated.
@ -172,7 +172,7 @@ pci_device_next( struct pci_device_iterator * iter )
case match_slot: {
while ( iter->next_index < pci_sys->num_devices ) {
struct pci_device_private * const temp =
struct pci_device_private * const temp =
& pci_sys->devices[ iter->next_index ];
iter->next_index++;
@ -184,13 +184,13 @@ pci_device_next( struct pci_device_iterator * iter )
break;
}
}
break;
}
case match_id: {
while ( iter->next_index < pci_sys->num_devices ) {
struct pci_device_private * const temp =
struct pci_device_private * const temp =
& pci_sys->devices[ iter->next_index ];
iter->next_index++;
@ -198,13 +198,13 @@ pci_device_next( struct pci_device_iterator * iter )
&& PCI_ID_COMPARE( iter->match.id.device_id, temp->base.device_id )
&& PCI_ID_COMPARE( iter->match.id.subvendor_id, temp->base.subvendor_id )
&& PCI_ID_COMPARE( iter->match.id.subdevice_id, temp->base.subdevice_id )
&& ((temp->base.device_class & iter->match.id.device_class_mask)
&& ((temp->base.device_class & iter->match.id.device_class_mask)
== iter->match.id.device_class) ) {
d = temp;
break;
}
}
break;
}
}
@ -218,8 +218,8 @@ pci_device_find_by_slot( uint32_t domain, uint32_t bus, uint32_t dev,
uint32_t func )
{
struct pci_device_iterator iter;
iter.next_index = 0;
iter.mode = match_slot;
iter.match.slot.domain = domain;

View File

@ -90,10 +90,10 @@ struct freebsd_pci_system {
/**
* Map a memory region for a device using /dev/mem.
*
*
* \param dev Device whose memory region is to be mapped.
* \param map Parameters of the mapping that is to be created.
*
*
* \return
* Zero on success or an \c errno value on failure.
*/
@ -101,7 +101,7 @@ static int
pci_device_freebsd_map_range(struct pci_device *dev,
struct pci_device_mapping *map)
{
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? (PROT_READ | PROT_WRITE) : PROT_READ;
struct mem_range_desc mrd;
struct mem_range_op mro;
@ -200,7 +200,7 @@ pci_device_freebsd_read( struct pci_device * dev, void * data,
io.pi_reg = offset;
io.pi_width = toread;
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCREAD, &io ) < 0 )
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCREAD, &io ) < 0 )
return errno;
memcpy(data, &io.pi_data, toread );
@ -241,7 +241,7 @@ pci_device_freebsd_write( struct pci_device * dev, const void * data,
io.pi_width = towrite;
memcpy( &io.pi_data, data, towrite );
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCWRITE, &io ) < 0 )
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCWRITE, &io ) < 0 )
return errno;
offset += towrite;
@ -365,7 +365,7 @@ pci_device_freebsd_probe( struct pci_device * dev )
for (i = 0; i < pci_device_freebsd_get_num_regions( dev ); i++) {
bar.pbi_reg = PCIR_BAR(i);
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCGETBAR, &bar ) < 0 )
if ( ioctl( freebsd_pci_sys->pcidev, PCIOCGETBAR, &bar ) < 0 )
continue;
if (PCI_BAR_IO(bar.pbi_base))
@ -440,7 +440,7 @@ pci_device_freebsd_get_region_info( struct pci_device * dev, int region,
/*
* We are going to be doing evil things to the registers here
* so disable them via the command register first.
* so disable them via the command register first.
*/
err = pci_device_cfg_read_u16( dev, &cmd, PCIR_COMMAND );
if (err != 0)

View File

@ -25,7 +25,7 @@
/**
* \file linux_devmem.c
* Access PCI subsystem using Linux's the old /dev/mem interface.
*
*
* \note
* This is currently just a skeleton. It only includes the /dev/mem based
* function for reading the device ROM.
@ -52,11 +52,11 @@
/**
* Read a device's expansion ROM using /dev/mem.
*
*
* \note
* This function could probably be used, as-is, on other platforms that have
* a /dev/mem interface.
*
*
* \bugs
* Before using the VGA special case code, this function should check that
* VGA access are routed to the device. Right?
@ -94,7 +94,7 @@ pci_device_linux_devmem_read_rom(struct pci_device *dev, void *buffer)
rom_size = priv->base.rom_size;
PCI_ROM = 1;
}
/* Enable the device's ROM.
@ -106,15 +106,15 @@ pci_device_linux_devmem_read_rom(struct pci_device *dev, void *buffer)
}
if ((rom_base_tmp & 0x000000001) == 0) {
err = pci_device_cfg_write_u32(& priv->base,
err = pci_device_cfg_write_u32(& priv->base,
rom_base_tmp | 1, 48);
if (err) {
return err;
}
}
}
/* Read the portion of /dev/mem that corresponds to the device's ROM.
*/
fd = open("/dev/mem", O_RDONLY, 0);
@ -125,7 +125,7 @@ pci_device_linux_devmem_read_rom(struct pci_device *dev, void *buffer)
size_t bytes;
for (bytes = 0; bytes < rom_size; /* empty */) {
const ssize_t got = pread(fd, buffer, rom_size - bytes,
const ssize_t got = pread(fd, buffer, rom_size - bytes,
rom_base + bytes);
if (got == -1) {
err = errno;
@ -138,7 +138,7 @@ pci_device_linux_devmem_read_rom(struct pci_device *dev, void *buffer)
close(fd);
}
/* Disable the device's ROM.
*/
if (PCI_ROM && ((rom_base_tmp & 0x000000001) == 0)) {

View File

@ -26,7 +26,7 @@
* \file linux_devmem.h
* Functions and datastructures that are private to the /dev/mem based
* back-end for pciaccess.
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/

View File

@ -1,6 +1,7 @@
/*
* (C) Copyright IBM Corporation 2006
* All Rights Reserved.
* Copyright 2012 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -44,6 +45,18 @@
#include <dirent.h>
#include <errno.h>
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
#include <sys/io.h>
#else
#define inb(x) -1
#define inw(x) -1
#define inl(x) -1
#define outb(x) do {} while (0)
#define outw(x) do {} while (0)
#define outl(x) do {} while (0)
#define iopl(x) -1
#endif
#include "config.h"
#ifdef HAVE_MTRR
@ -79,7 +92,7 @@ pci_system_linux_sysfs_create( void )
/* If the directory "/sys/bus/pci/devices" exists, then the PCI subsystem
* can be accessed using this interface.
*/
if ( stat( SYS_BUS_PCI, & st ) == 0 ) {
pci_sys = calloc( 1, sizeof( struct pci_system ) );
if ( pci_sys != NULL ) {
@ -114,7 +127,7 @@ pci_system_linux_sysfs_create( void )
static int
scan_sys_pci_filter( const struct dirent * d )
{
return !((strcmp( d->d_name, "." ) == 0)
return !((strcmp( d->d_name, "." ) == 0)
|| (strcmp( d->d_name, ".." ) == 0));
}
@ -122,7 +135,7 @@ scan_sys_pci_filter( const struct dirent * d )
int
populate_entries( struct pci_system * p )
{
struct dirent ** devices;
struct dirent ** devices = NULL;
int n;
int i;
int err = 0;
@ -219,7 +232,7 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
* parsing issues and non-root users can write to PCI config
* registers, we use a different file in the device's sysfs
* directory called "resource".
*
*
* The resource file contains all of the needed information in
* a format that is consistent across all platforms. Each BAR
* and the expansion ROM have a single line of data containing
@ -251,9 +264,9 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
dev->regions[i].base_addr = strtoull( next, & next, 16 );
high_addr = strtoull( next, & next, 16 );
flags = strtoull( next, & next, 16 );
if ( dev->regions[i].base_addr != 0 ) {
dev->regions[i].size = (high_addr
dev->regions[i].size = (high_addr
- dev->regions[i].base_addr) + 1;
dev->regions[i].is_IO = (flags & 0x01);
@ -293,7 +306,7 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
dev->bus,
dev->dev,
dev->func );
fd = open( name, O_RDWR );
if ( fd == -1 ) {
#ifdef LINUX_ROM
@ -338,7 +351,7 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
total_bytes += bytes;
}
lseek( fd, 0, SEEK_SET );
write( fd, "0", 1 );
@ -387,7 +400,9 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
/* If zero bytes were read, then we assume it's the end of the
* config file.
*/
if ( bytes <= 0 ) {
if (bytes == 0)
break;
if ( bytes < 0 ) {
err = errno;
break;
}
@ -396,7 +411,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
offset += bytes;
data_bytes += bytes;
}
if ( bytes_read != NULL ) {
*bytes_read = size - temp_size;
}
@ -445,7 +460,9 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
/* If zero bytes were written, then we assume it's the end of the
* config file.
*/
if ( bytes <= 0 ) {
if ( bytes == 0 )
break;
if ( bytes < 0 ) {
err = errno;
break;
}
@ -454,7 +471,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
offset += bytes;
data_bytes += bytes;
}
if ( bytes_written != NULL ) {
*bytes_written = size - temp_size;
}
@ -469,9 +486,9 @@ pci_device_linux_sysfs_map_range_wc(struct pci_device *dev,
{
char name[256];
int fd;
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? (PROT_READ | PROT_WRITE) : PROT_READ;
const int open_flags = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
const int open_flags = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? O_RDWR : O_RDONLY;
const off_t offset = map->base - dev->regions[map->region].base_addr;
@ -500,10 +517,10 @@ pci_device_linux_sysfs_map_range_wc(struct pci_device *dev,
/**
* Map a memory region for a device using the Linux sysfs interface.
*
*
* \param dev Device whose memory region is to be mapped.
* \param map Parameters of the mapping that is to be created.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -521,9 +538,9 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
char name[256];
int fd;
int err = 0;
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? (PROT_READ | PROT_WRITE) : PROT_READ;
const int open_flags = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
const int open_flags = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? O_RDWR : O_RDONLY;
const off_t offset = map->base - dev->regions[map->region].base_addr;
#ifdef HAVE_MTRR
@ -604,10 +621,10 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
/**
* Unmap a memory region for a device using the Linux sysfs interface.
*
*
* \param dev Device whose memory region is to be unmapped.
* \param map Parameters of the mapping that is to be destroyed.
*
*
* \return
* Zero on success or an \c errno value on failure.
*
@ -634,7 +651,7 @@ pci_device_linux_sysfs_unmap_range(struct pci_device *dev,
err = pci_device_generic_unmap_range (dev, map);
if (err)
return err;
#ifdef HAVE_MTRR
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) != 0) {
sentry.type = MTRR_TYPE_WRBACK;
@ -669,7 +686,7 @@ static void pci_device_linux_sysfs_enable(struct pci_device *dev)
dev->bus,
dev->dev,
dev->func );
fd = open( name, O_RDWR );
if (fd == -1)
return;
@ -691,7 +708,7 @@ static int pci_device_linux_sysfs_boot_vga(struct pci_device *dev)
dev->bus,
dev->dev,
dev->func );
fd = open( name, O_RDONLY );
if (fd == -1)
return 0;
@ -718,7 +735,7 @@ static int pci_device_linux_sysfs_has_kernel_driver(struct pci_device *dev)
dev->bus,
dev->dev,
dev->func );
ret = stat(name, &dummy);
if (ret < 0)
return 0;
@ -765,12 +782,17 @@ pci_device_linux_sysfs_open_legacy_io(struct pci_io_handle *ret,
dev = pci_device_get_parent_bridge(dev);
}
/* If not, /dev/port is the best we can do */
if (!dev)
ret->fd = open("/dev/port", O_RDWR);
/*
* You would think you'd want to use /dev/port here. Don't make that
* mistake, /dev/port only does byte-wide i/o cycles which means it
* doesn't work. If you think this is stupid, well, you're right.
*/
if (ret->fd < 0)
return NULL;
/* If we've no other choice, iopl */
if (ret->fd < 0) {
if (iopl(3))
return NULL;
}
ret->base = base;
ret->size = size;
@ -782,7 +804,8 @@ static void
pci_device_linux_sysfs_close_io(struct pci_device *dev,
struct pci_io_handle *handle)
{
close(handle->fd);
if (handle->fd > -1)
close(handle->fd);
}
static uint32_t
@ -790,8 +813,11 @@ pci_device_linux_sysfs_read32(struct pci_io_handle *handle, uint32_t port)
{
uint32_t ret;
pread(handle->fd, &ret, 4, port + handle->base);
if (handle->fd > -1)
pread(handle->fd, &ret, 4, port + handle->base);
else
ret = inl(port + handle->base);
return ret;
}
@ -800,7 +826,10 @@ pci_device_linux_sysfs_read16(struct pci_io_handle *handle, uint32_t port)
{
uint16_t ret;
pread(handle->fd, &ret, 2, port + handle->base);
if (handle->fd > -1)
pread(handle->fd, &ret, 2, port + handle->base);
else
ret = inw(port + handle->base);
return ret;
}
@ -810,7 +839,10 @@ pci_device_linux_sysfs_read8(struct pci_io_handle *handle, uint32_t port)
{
uint8_t ret;
pread(handle->fd, &ret, 1, port + handle->base);
if (handle->fd > -1)
pread(handle->fd, &ret, 1, port + handle->base);
else
ret = inb(port + handle->base);
return ret;
}
@ -819,25 +851,93 @@ static void
pci_device_linux_sysfs_write32(struct pci_io_handle *handle, uint32_t port,
uint32_t data)
{
pwrite(handle->fd, &data, 4, port + handle->base);
if (handle->fd > -1)
pwrite(handle->fd, &data, 4, port + handle->base);
else
outl(data, port + handle->base);
}
static void
pci_device_linux_sysfs_write16(struct pci_io_handle *handle, uint32_t port,
uint16_t data)
{
pwrite(handle->fd, &data, 2, port + handle->base);
if (handle->fd > -1)
pwrite(handle->fd, &data, 2, port + handle->base);
else
outw(data, port + handle->base);
}
static void
pci_device_linux_sysfs_write8(struct pci_io_handle *handle, uint32_t port,
uint8_t data)
{
pwrite(handle->fd, &data, 1, port + handle->base);
if (handle->fd > -1)
pwrite(handle->fd, &data, 1, port + handle->base);
else
outb(data, port + handle->base);
}
static int
pci_device_linux_sysfs_map_legacy(struct pci_device *dev, pciaddr_t base,
pciaddr_t size, unsigned map_flags, void **addr)
{
char name[PATH_MAX];
int flags = O_RDONLY;
int prot = PROT_READ;
int fd;
int ret=0;
if (map_flags & PCI_DEV_MAP_FLAG_WRITABLE) {
flags = O_RDWR; /* O_RDWR != O_WRONLY | O_RDONLY */;
prot |= PROT_WRITE;
}
/* First check if there's a legacy memory method for the device */
while (dev) {
snprintf(name, PATH_MAX, "/sys/class/pci_bus/%04x:%02x/legacy_mem",
dev->domain, dev->bus);
fd = open(name, flags);
if (fd >= 0)
break;
dev = pci_device_get_parent_bridge(dev);
}
/* If not, /dev/mem is the best we can do */
if (!dev)
fd = open("/dev/mem", flags);
if (fd < 0)
return errno;
*addr = mmap(NULL, size, prot, MAP_SHARED, fd, base);
if (*addr == MAP_FAILED) {
ret = errno;
}
close(fd);
return ret;
}
static int
pci_device_linux_sysfs_unmap_legacy(struct pci_device *dev, void *addr, pciaddr_t size)
{
return munmap(addr, size);
}
static void
pci_system_linux_destroy(void)
{
#ifdef HAVE_MTRR
if (pci_sys->mtrr_fd != -1)
close(pci_sys->mtrr_fd);
#endif
}
static const struct pci_system_methods linux_sysfs_methods = {
.destroy = NULL,
.destroy = pci_system_linux_destroy,
.destroy_device = NULL,
.read_rom = pci_device_linux_sysfs_read_rom,
.probe = pci_device_linux_sysfs_probe,
@ -861,4 +961,7 @@ static const struct pci_system_methods linux_sysfs_methods = {
.write32 = pci_device_linux_sysfs_write32,
.write16 = pci_device_linux_sysfs_write16,
.write8 = pci_device_linux_sysfs_write8,
.map_legacy = pci_device_linux_sysfs_map_legacy,
.unmap_legacy = pci_device_linux_sysfs_unmap_legacy,
};

View File

@ -210,7 +210,7 @@ pci_device_netbsd_write(struct pci_device *dev, const void *data,
io.cfgreg.reg = offset;
memcpy(&io.cfgreg.val, data, 4);
if (ioctl(pcifd, PCI_IOC_BDF_CFGWRITE, &io) == -1)
if (ioctl(pcifd, PCI_IOC_BDF_CFGWRITE, &io) == -1)
return errno;
offset += 4;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008 Mark Kettenis
* Copyright (c) 2008, 2011 Mark Kettenis
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -192,7 +192,8 @@ pci_device_openbsd_map_range(struct pci_device *dev,
mo.mo_arg[0] = MEMRANGE_SET_UPDATE;
if (ioctl(aperturefd, MEMRANGE_SET, &mo))
(void)fprintf(stderr, "mtrr set failed: %s\n",
(void)fprintf(stderr, "mtrr set %lx %lx failed: %s\n",
(intptr_t)map->base, (intptr_t)map->size,
strerror(errno));
}
#endif
@ -394,6 +395,141 @@ pci_device_openbsd_probe(struct pci_device *device)
return 0;
}
#if defined(__i386__) || defined(__amd64__)
#include <machine/sysarch.h>
#include <machine/pio.h>
#endif
static struct pci_io_handle *
pci_device_openbsd_open_legacy_io(struct pci_io_handle *ret,
struct pci_device *dev, pciaddr_t base, pciaddr_t size)
{
#if defined(__i386__)
struct i386_iopl_args ia;
ia.iopl = 1;
if (sysarch(I386_IOPL, &ia))
return NULL;
ret->base = base;
ret->size = size;
return ret;
#elif defined(__amd64__)
struct amd64_iopl_args ia;
ia.iopl = 1;
if (sysarch(AMD64_IOPL, &ia))
return NULL;
ret->base = base;
ret->size = size;
return ret;
#elif defined(PCI_MAGIC_IO_RANGE)
ret->memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
aperturefd, PCI_MAGIC_IO_RANGE + base);
if (ret->memory == MAP_FAILED)
return NULL;
ret->base = base;
ret->size = size;
return ret;
#else
return NULL;
#endif
}
static uint32_t
pci_device_openbsd_read32(struct pci_io_handle *handle, uint32_t reg)
{
#if defined(__i386__) || defined(__amd64__)
return inl(handle->base + reg);
#else
return *(uint32_t *)((uintptr_t)handle->memory + reg);
#endif
}
static uint16_t
pci_device_openbsd_read16(struct pci_io_handle *handle, uint32_t reg)
{
#if defined(__i386__) || defined(__amd64__)
return inw(handle->base + reg);
#else
return *(uint16_t *)((uintptr_t)handle->memory + reg);
#endif
}
static uint8_t
pci_device_openbsd_read8(struct pci_io_handle *handle, uint32_t reg)
{
#if defined(__i386__) || defined(__amd64__)
return inb(handle->base + reg);
#else
return *(uint8_t *)((uintptr_t)handle->memory + reg);
#endif
}
static void
pci_device_openbsd_write32(struct pci_io_handle *handle, uint32_t reg,
uint32_t data)
{
#if defined(__i386__) || defined(__amd64__)
outl(handle->base + reg, data);
#else
*(uint16_t *)((uintptr_t)handle->memory + reg) = data;
#endif
}
static void
pci_device_openbsd_write16(struct pci_io_handle *handle, uint32_t reg,
uint16_t data)
{
#if defined(__i386__) || defined(__amd64__)
outw(handle->base + reg, data);
#else
*(uint8_t *)((uintptr_t)handle->memory + reg) = data;
#endif
}
static void
pci_device_openbsd_write8(struct pci_io_handle *handle, uint32_t reg,
uint8_t data)
{
#if defined(__i386__) || defined(__amd64__)
outb(handle->base + reg, data);
#else
*(uint32_t *)((uintptr_t)handle->memory + reg) = data;
#endif
}
static int
pci_device_openbsd_map_legacy(struct pci_device *dev, pciaddr_t base,
pciaddr_t size, unsigned map_flags, void **addr)
{
struct pci_device_mapping map;
int err;
map.base = base;
map.size = size;
map.flags = map_flags;
map.memory = NULL;
err = pci_device_openbsd_map_range(dev, &map);
*addr = map.memory;
return err;
}
static int
pci_device_openbsd_unmap_legacy(struct pci_device *dev, void *addr,
pciaddr_t size)
{
struct pci_device_mapping map;
map.memory = addr;
map.size = size;
map.flags = 0;
return pci_device_openbsd_unmap_range(dev, &map);
}
static const struct pci_system_methods openbsd_pci_methods = {
pci_system_openbsd_destroy,
NULL,
@ -403,7 +539,21 @@ static const struct pci_system_methods openbsd_pci_methods = {
pci_device_openbsd_unmap_range,
pci_device_openbsd_read,
pci_device_openbsd_write,
pci_fill_capabilities_generic
pci_fill_capabilities_generic,
NULL,
NULL,
NULL,
NULL,
pci_device_openbsd_open_legacy_io,
NULL,
pci_device_openbsd_read32,
pci_device_openbsd_read16,
pci_device_openbsd_read8,
pci_device_openbsd_write32,
pci_device_openbsd_write16,
pci_device_openbsd_write8,
pci_device_openbsd_map_legacy,
pci_device_openbsd_unmap_legacy
};
int
@ -584,7 +734,6 @@ int
pci_device_vgaarb_set_target(struct pci_device *dev)
{
pci_sys->vga_target = dev;
return 0;
}
int

View File

@ -25,7 +25,7 @@
/**
* \file pciaccess_private.h
* Functions and datastructures that are private to the pciaccess library.
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/
@ -46,12 +46,12 @@ int pci_device_generic_unmap_range(struct pci_device *dev,
struct pci_system_methods {
void (*destroy)( void );
void (*destroy_device)( struct pci_device * dev );
int (*read_rom)( struct pci_device * dev, void * buffer );
int (*read_rom)( struct pci_device * dev, void * buffer );
int (*probe)( struct pci_device * dev );
int (*map_range)(struct pci_device *dev, struct pci_device_mapping *map);
int (*unmap_range)(struct pci_device * dev,
struct pci_device_mapping *map);
int (*read)(struct pci_device * dev, void * data, pciaddr_t offset,
pciaddr_t size, pciaddr_t * bytes_read );
@ -77,6 +77,10 @@ struct pci_system_methods {
void (*write16)( struct pci_io_handle *handle, uint32_t reg,
uint16_t data );
void (*write8)( struct pci_io_handle *handle, uint32_t reg, uint8_t data );
int (*map_legacy)(struct pci_device *dev, pciaddr_t base, pciaddr_t size,
unsigned map_flags, void **addr);
int (*unmap_legacy)(struct pci_device *dev, void *addr, pciaddr_t size);
};
struct pci_device_mapping {
@ -90,13 +94,14 @@ struct pci_device_mapping {
struct pci_io_handle {
pciaddr_t base;
pciaddr_t size;
void *memory;
int fd;
};
struct pci_device_private {
struct pci_device base;
const char * device_string;
uint8_t header_type;
/**
@ -105,7 +110,7 @@ struct pci_device_private {
/*@{*/
const struct pci_agp_info * agp; /**< AGP capability information. */
/*@}*/
/**
* Base address of the device's expansion ROM.
*/

View File

@ -1,6 +1,6 @@
/*
* (C) Copyright IBM Corporation 2006
* Copyright (c) 2007, 2009, Oracle and/or its affiliates.
* Copyright (c) 2007, 2009, 2011, Oracle and/or its affiliates.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@ -43,7 +43,7 @@
/* #define DEBUG */
#define MAX_DEVICES 256
#define INITIAL_NUM_DEVICES 256
#define CELL_NUMS_1275 (sizeof(pci_regspec_t) / sizeof(uint_t))
typedef union {
@ -62,12 +62,31 @@ typedef struct nexus {
int fd;
int first_bus;
int last_bus;
int domain;
char *path; /* for errors/debugging; fd is all we need */
char *dev_path;
struct nexus *next;
#ifdef __sparc
struct pci_device **devlist;
volatile size_t num_allocated_elems;
volatile size_t num_devices;
#endif
} nexus_t;
typedef struct probe_info {
volatile size_t num_allocated_elems;
volatile size_t num_devices;
struct pci_device_private * volatile devices;
} probe_info_t;
static nexus_t *nexus_list = NULL;
#if !defined(__sparc)
static int xsvc_fd = -1;
#endif
#ifdef __sparc
static di_prom_handle_t di_phdl;
#endif
/*
* Read config space in native processor endianness. Endian-neutral
@ -83,6 +102,10 @@ static int xsvc_fd = -1;
# error "ISA is neither __sparc nor __x86"
#endif
#ifdef __sparc
#define MAPPING_DEV_PATH(dev) (((struct pci_device_private *) dev)->device_string)
#endif
/*
* Identify problematic southbridges. These have device id 0x5249 and
* vendor id 0x10b9. Check for revision ID 0 and class code 060400 as well.
@ -103,61 +126,36 @@ static int xsvc_fd = -1;
# define U45_SB_CLASS_RID 0x06040000
#endif
static int pci_device_solx_devfs_map_range(struct pci_device *dev,
struct pci_device_mapping *map);
static int pci_device_solx_devfs_read_rom( struct pci_device * dev,
void * buffer );
static int pci_device_solx_devfs_probe( struct pci_device * dev );
static int pci_device_solx_devfs_read( struct pci_device * dev, void * data,
pciaddr_t offset, pciaddr_t size, pciaddr_t * bytes_read );
static int pci_device_solx_devfs_write( struct pci_device * dev,
const void * data, pciaddr_t offset, pciaddr_t size,
pciaddr_t * bytes_written );
static int probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p,
struct pci_system *pci_sys);
static int do_probe(nexus_t *nexus, struct pci_system *pci_sys);
static int probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg);
static void pci_system_solx_devfs_destroy( void );
static int get_config_header(int fd, uint8_t bus_no, uint8_t dev_no,
uint8_t func_no, pci_conf_hdr_t *config_hdr_p);
int pci_system_solx_devfs_create( void );
static const struct pci_system_methods solx_devfs_methods = {
.destroy = pci_system_solx_devfs_destroy,
.destroy_device = NULL,
.read_rom = pci_device_solx_devfs_read_rom,
.probe = pci_device_solx_devfs_probe,
.map_range = pci_device_solx_devfs_map_range,
.unmap_range = pci_device_generic_unmap_range,
.read = pci_device_solx_devfs_read,
.write = pci_device_solx_devfs_write,
.fill_capabilities = pci_fill_capabilities_generic
};
#ifdef __sparc
static nexus_t *
find_nexus_for_bus( int bus )
find_nexus_for_dev(struct pci_device *dev)
{
nexus_t *nexus;
int i;
for (nexus = nexus_list ; nexus != NULL ; nexus = nexus->next) {
for (i = 0; i < nexus->num_devices; i++) {
if (nexus->devlist[i] == dev)
return nexus;
}
}
return NULL;
}
#else
static nexus_t *
find_nexus_for_bus( int domain, int bus )
{
nexus_t *nexus;
for (nexus = nexus_list ; nexus != NULL ; nexus = nexus->next) {
if ((bus >= nexus->first_bus) && (bus <= nexus->last_bus)) {
if ((domain == nexus->domain) &&
(bus >= nexus->first_bus) && (bus <= nexus->last_bus)) {
return nexus;
}
}
return NULL;
}
#endif
#define GET_CONFIG_VAL_8(offset) (config_hdr.bytes[offset])
#define GET_CONFIG_VAL_16(offset) \
@ -186,69 +184,33 @@ pci_system_solx_devfs_destroy( void )
next = nexus->next;
close(nexus->fd);
free(nexus->path);
free(nexus->dev_path);
#ifdef __sparc
{
struct pci_device *dev;
int i;
for (i = 0; i < nexus->num_devices; i++) {
dev = nexus->devlist[i];
if (MAPPING_DEV_PATH(dev))
di_devfs_path_free((char *) MAPPING_DEV_PATH(dev));
}
}
free(nexus->devlist);
#endif
free(nexus);
}
nexus_list = NULL;
#ifdef __sparc
if (di_phdl != DI_PROM_HANDLE_NIL)
(void) di_prom_fini(di_phdl);
#else
if (xsvc_fd >= 0) {
close(xsvc_fd);
xsvc_fd = -1;
}
}
/*
* Attempt to access PCI subsystem using Solaris's devfs interface.
* Solaris version
*/
_pci_hidden int
pci_system_solx_devfs_create( void )
{
int err = 0;
di_node_t di_node;
if (nexus_list != NULL) {
return 0;
}
/*
* Only allow MAX_DEVICES exists
* I will fix it later to get
* the total devices first
*/
if ((pci_sys = calloc(1, sizeof (struct pci_system))) != NULL) {
pci_sys->methods = &solx_devfs_methods;
if ((pci_sys->devices =
calloc(MAX_DEVICES, sizeof (struct pci_device_private)))
!= NULL) {
if ((di_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "di_init() failed: %s\n",
strerror(errno));
} else {
(void) di_walk_minor(di_node, DDI_NT_REGACC, 0, pci_sys,
probe_nexus_node);
di_fini(di_node);
}
}
else {
err = errno;
}
} else {
err = errno;
}
if (err != 0) {
if (pci_sys != NULL) {
free(pci_sys->devices);
free(pci_sys);
pci_sys = NULL;
}
}
return (err);
#endif
}
/*
@ -289,7 +251,7 @@ get_config_header(int fd, uint8_t bus_no, uint8_t dev_no, uint8_t func_no,
* Probe device's functions. Modifies many fields in the prg_p.
*/
static int
probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, probe_info_t *pinfo)
{
pci_conf_hdr_t config_hdr;
boolean_t multi_function_device;
@ -367,6 +329,10 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
else if (((errno != EFAULT) ||
(prg_p->status != PCITOOL_INVALID_ADDRESS)) &&
(prg_p->data != 0xffffffff)) {
#ifdef __sparc
/* on sparc, devices can be enumerated discontiguously. Do not quit */
rval = 0;
#endif
break;
}
@ -412,12 +378,9 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
* function number.
*/
pci_base = &pci_sys->devices[pci_sys->num_devices].base;
pci_base = &pinfo->devices[pinfo->num_devices].base;
/*
* Domain is peer bus??
*/
pci_base->domain = 0;
pci_base->domain = nexus->domain;
pci_base->bus = prg_p->bus_no;
pci_base->dev = prg_p->dev_no;
pci_base->func = func;
@ -436,8 +399,9 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
pci_base->device_id = GET_CONFIG_VAL_16(PCI_CONF_DEVID);
pci_base->subvendor_id = GET_CONFIG_VAL_16(PCI_CONF_SUBVENID);
pci_base->subdevice_id = GET_CONFIG_VAL_16(PCI_CONF_SUBSYSID);
pci_base->irq = GET_CONFIG_VAL_8(PCI_CONF_ILINE);
pci_sys->devices[pci_sys->num_devices].header_type
pinfo->devices[pinfo->num_devices].header_type
= GET_CONFIG_VAL_8(PCI_CONF_HEADER);
#ifdef DEBUG
@ -446,14 +410,45 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
nexus->path, prg_p->bus_no, prg_p->dev_no, func);
#endif
if (pci_sys->num_devices < (MAX_DEVICES - 1)) {
pci_sys->num_devices++;
} else {
(void) fprintf(stderr,
"Maximum number of PCI devices found,"
" discarding additional devices\n");
pinfo->num_devices++;
if (pinfo->num_devices == pinfo->num_allocated_elems) {
struct pci_device_private *new_devs;
size_t new_num_elems = pinfo->num_allocated_elems * 2;
new_devs = realloc(pinfo->devices,
new_num_elems * sizeof (struct pci_device_private));
if (new_devs == NULL) {
(void) fprintf(stderr,
"Error allocating memory for PCI devices:"
" %s\n discarding additional devices\n",
strerror(errno));
return (rval);
}
(void) memset(&new_devs[pinfo->num_devices], 0,
pinfo->num_allocated_elems *
sizeof (struct pci_device_private));
pinfo->num_allocated_elems = new_num_elems;
pinfo->devices = new_devs;
}
#ifdef __sparc
nexus->devlist[nexus->num_devices++] = pci_base;
if (nexus->num_devices == nexus->num_allocated_elems) {
struct pci_device **new_devs;
size_t new_num_elems = nexus->num_allocated_elems * 2;
new_devs = realloc(nexus->devlist,
new_num_elems * sizeof (struct pci_device *));
if (new_devs == NULL)
return (rval);
(void) memset(&new_devs[nexus->num_devices], 0,
nexus->num_allocated_elems *
sizeof (struct pci_device *));
nexus->num_allocated_elems = new_num_elems;
nexus->devlist = new_devs;
}
#endif
/*
* Accommodate devices which state their
@ -470,113 +465,6 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, struct pci_system *pci_sys)
return (rval);
}
/*
* This function is called from di_walk_minor() when any PROBE is processed
*/
static int
probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
{
struct pci_system *pci_sys = (struct pci_system *) arg;
char *nexus_name;
nexus_t *nexus;
int fd;
char nexus_path[MAXPATHLEN];
di_prop_t prop;
char *strings;
int *ints;
int numval;
int pci_node = 0;
int first_bus = 0, last_bus = PCI_REG_BUS_G(PCI_REG_BUS_M);
#ifdef DEBUG
nexus_name = di_devfs_minor_path(minor);
fprintf(stderr, "-- device name: %s\n", nexus_name);
#endif
for (prop = di_prop_next(di_node, NULL); prop != NULL;
prop = di_prop_next(di_node, prop)) {
const char *prop_name = di_prop_name(prop);
#ifdef DEBUG
fprintf(stderr, " property: %s\n", prop_name);
#endif
if (strcmp(prop_name, "device_type") == 0) {
numval = di_prop_strings(prop, &strings);
if (numval != 1 || strncmp(strings, "pci", 3) != 0) {
/* not a PCI node, bail */
return (DI_WALK_CONTINUE);
}
pci_node = 1;
}
else if (strcmp(prop_name, "class-code") == 0) {
/* not a root bus node, bail */
return (DI_WALK_CONTINUE);
}
else if (strcmp(prop_name, "bus-range") == 0) {
numval = di_prop_ints(prop, &ints);
if (numval == 2) {
first_bus = ints[0];
last_bus = ints[1];
}
}
}
#ifdef __x86 /* sparc pci nodes don't have the device_type set */
if (pci_node != 1)
return (DI_WALK_CONTINUE);
#endif
/* we have a PCI root bus node. */
nexus = calloc(1, sizeof(nexus_t));
if (nexus == NULL) {
(void) fprintf(stderr, "Error allocating memory for nexus: %s\n",
strerror(errno));
return (DI_WALK_TERMINATE);
}
nexus->first_bus = first_bus;
nexus->last_bus = last_bus;
nexus_name = di_devfs_minor_path(minor);
if (nexus_name == NULL) {
(void) fprintf(stderr, "Error getting nexus path: %s\n",
strerror(errno));
free(nexus);
return (DI_WALK_CONTINUE);
}
snprintf(nexus_path, sizeof(nexus_path), "/devices%s", nexus_name);
di_devfs_path_free(nexus_name);
#ifdef DEBUG
fprintf(stderr, "nexus = %s, bus-range = %d - %d\n",
nexus_path, first_bus, last_bus);
#endif
if ((fd = open(nexus_path, O_RDWR)) >= 0) {
nexus->fd = fd;
nexus->path = strdup(nexus_path);
if ((do_probe(nexus, pci_sys) != 0) && (errno != ENXIO)) {
(void) fprintf(stderr, "Error probing node %s: %s\n",
nexus_path, strerror(errno));
(void) close(fd);
free(nexus->path);
free(nexus);
} else {
nexus->next = nexus_list;
nexus_list = nexus;
}
} else {
(void) fprintf(stderr, "Error opening %s: %s\n",
nexus_path, strerror(errno));
free(nexus);
}
return DI_WALK_CONTINUE;
}
/*
* Solaris version
@ -586,7 +474,7 @@ probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
* input_args contains commandline options as specified by the user.
*/
static int
do_probe(nexus_t *nexus, struct pci_system *pci_sys)
do_probe(nexus_t *nexus, probe_info_t *pinfo)
{
pcitool_reg_t prg;
uint32_t bus;
@ -620,7 +508,7 @@ do_probe(nexus_t *nexus, struct pci_system *pci_sys)
for (dev = first_dev; ((dev <= last_dev) && (rval == 0)); dev++) {
prg.dev_no = dev;
rval = probe_dev(nexus, &prg, pci_sys);
rval = probe_dev(nexus, &prg, pinfo);
}
/*
@ -635,6 +523,172 @@ do_probe(nexus_t *nexus, struct pci_system *pci_sys)
return (rval);
}
/*
* This function is called from di_walk_minor() when any PROBE is processed
*/
static int
probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
{
probe_info_t *pinfo = (probe_info_t *)arg;
char *nexus_name, *nexus_dev_path;
nexus_t *nexus;
int fd;
char nexus_path[MAXPATHLEN];
di_prop_t prop;
char *strings;
int *ints;
int numval;
int pci_node = 0;
int first_bus = 0, last_bus = PCI_REG_BUS_G(PCI_REG_BUS_M);
int domain = 0;
#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);
#endif
for (prop = di_prop_next(di_node, NULL); prop != NULL;
prop = di_prop_next(di_node, prop)) {
const char *prop_name = di_prop_name(prop);
#ifdef DEBUG
fprintf(stderr, " property: %s\n", prop_name);
#endif
if (strcmp(prop_name, "device_type") == 0) {
numval = di_prop_strings(prop, &strings);
if (numval == 1) {
if (strncmp(strings, "pci", 3) != 0)
/* not a PCI node, bail */
return (DI_WALK_CONTINUE);
else {
pci_node = 1;
#ifdef __sparc
device_type_found = 1;
#endif
}
}
}
else if (strcmp(prop_name, "class-code") == 0) {
/* not a root bus node, bail */
return (DI_WALK_CONTINUE);
}
else if (strcmp(prop_name, "bus-range") == 0) {
numval = di_prop_ints(prop, &ints);
if (numval == 2) {
first_bus = ints[0];
last_bus = ints[1];
#ifdef __sparc
bus_range_found = 1;
#endif
}
}
else if (strcmp(prop_name, "pciseg") == 0) {
numval = di_prop_ints(prop, &ints);
if (numval == 1) {
domain = ints[0];
}
}
}
#ifdef __sparc
if ((!device_type_found) && di_phdl) {
numval = di_prom_prop_lookup_strings(di_phdl, di_node,
"device_type", &strings);
if (numval == 1) {
if (strncmp(strings, "pci", 3) != 0)
return (DI_WALK_CONTINUE);
else
pci_node = 1;
}
}
if ((!bus_range_found) && di_phdl) {
numval = di_prom_prop_lookup_ints(di_phdl, di_node,
"bus-range", &ints);
if (numval == 2) {
first_bus = ints[0];
last_bus = ints[1];
}
}
#endif
if (pci_node != 1)
return (DI_WALK_CONTINUE);
/* we have a PCI root bus node. */
nexus = calloc(1, sizeof(nexus_t));
if (nexus == NULL) {
(void) fprintf(stderr, "Error allocating memory for nexus: %s\n",
strerror(errno));
return (DI_WALK_TERMINATE);
}
nexus->first_bus = first_bus;
nexus->last_bus = last_bus;
nexus->domain = domain;
#ifdef __sparc
if ((nexus->devlist = calloc(INITIAL_NUM_DEVICES,
sizeof (struct pci_device *))) == NULL) {
(void) fprintf(stderr, "Error allocating memory for nexus devlist: %s\n",
strerror(errno));
free (nexus);
return (DI_WALK_TERMINATE);
}
nexus->num_allocated_elems = INITIAL_NUM_DEVICES;
nexus->num_devices = 0;
#endif
nexus_name = di_devfs_minor_path(minor);
if (nexus_name == NULL) {
(void) fprintf(stderr, "Error getting nexus path: %s\n",
strerror(errno));
free(nexus);
return (DI_WALK_CONTINUE);
}
snprintf(nexus_path, sizeof(nexus_path), "/devices%s", nexus_name);
di_devfs_path_free(nexus_name);
#ifdef DEBUG
fprintf(stderr, "nexus = %s, bus-range = %d - %d\n",
nexus_path, first_bus, last_bus);
#endif
if ((fd = open(nexus_path, O_RDWR)) >= 0) {
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 ((do_probe(nexus, pinfo) != 0) && (errno != ENXIO)) {
(void) fprintf(stderr, "Error probing node %s: %s\n",
nexus_path, strerror(errno));
(void) close(fd);
free(nexus->path);
free(nexus->dev_path);
free(nexus);
} else {
nexus->next = nexus_list;
nexus_list = nexus;
}
} else {
(void) fprintf(stderr, "Error opening %s: %s\n",
nexus_path, strerror(errno));
free(nexus);
}
return DI_WALK_CONTINUE;
}
static int
find_target_node(di_node_t node, void *arg)
{
@ -667,6 +721,11 @@ find_target_node(di_node_t node, void *arg)
len = di_prop_lookup_ints(DDI_DEV_T_ANY, node, "reg", &regbuf);
#ifdef __sparc
if ((len <= 0) && di_phdl)
len = di_prom_prop_lookup_ints(di_phdl, node, "reg", &regbuf);
#endif
if (len <= 0) {
#ifdef DEBUG
fprintf(stderr, "error = %x\n", errno);
@ -696,55 +755,50 @@ find_target_node(di_node_t node, void *arg)
static int
pci_device_solx_devfs_probe( struct pci_device * dev )
{
uint8_t config[256];
int err;
int err = 0;
di_node_t rnode = DI_NODE_NIL;
i_devnode_t args = { 0, 0, 0, DI_NODE_NIL };
int *regbuf;
pci_regspec_t *reg;
int i;
pciaddr_t bytes;
int len = 0;
uint ent = 0;
nexus_t *nexus;
err = pci_device_solx_devfs_read( dev, config, 0, 256, & bytes );
#ifdef __sparc
if ( (nexus = find_nexus_for_dev(dev)) == NULL )
#else
if ( (nexus = find_nexus_for_bus(dev->domain, dev->bus)) == NULL )
#endif
return ENODEV;
if ( bytes >= 64 ) {
struct pci_device_private *priv =
(struct pci_device_private *) dev;
dev->vendor_id = (uint16_t)config[0] + ((uint16_t)config[1] << 8);
dev->device_id = (uint16_t)config[2] + ((uint16_t)config[3] << 8);
dev->device_class = (uint32_t)config[9] +
((uint32_t)config[10] << 8) +
((uint16_t)config[11] << 16);
/*
* device class code is already there.
* see probe_dev function.
*/
dev->revision = config[8];
dev->subvendor_id = (uint16_t)config[44] + ((uint16_t)config[45] << 8);
dev->subdevice_id = (uint16_t)config[46] + ((uint16_t)config[47] << 8);
dev->irq = config[60];
priv->header_type = config[14];
/*
* starting to find if it is MEM/MEM64/IO
* using libdevinfo
*/
if ((rnode = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
} else {
args.bus = dev->bus;
args.dev = dev->dev;
args.func = dev->func;
(void) di_walk_node(rnode, DI_WALK_CLDFIRST,
(void *)&args, find_target_node);
}
/*
* starting to find if it is MEM/MEM64/IO
* using libdevinfo
*/
if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
} else {
args.bus = dev->bus;
args.dev = dev->dev;
args.func = dev->func;
(void) di_walk_node(rnode, DI_WALK_CLDFIRST,
(void *)&args, find_target_node);
}
if (args.node != DI_NODE_NIL) {
#ifdef __sparc
di_minor_t minor;
#endif
#ifdef __sparc
if (minor = di_minor_next(args.node, DI_MINOR_NIL))
MAPPING_DEV_PATH(dev) = di_devfs_minor_path (minor);
else
MAPPING_DEV_PATH(dev) = NULL;
#endif
/*
* It will succeed for sure, because it was
* successfully called in find_target_node
@ -753,6 +807,12 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
"assigned-addresses",
&regbuf);
#ifdef __sparc
if ((len <= 0) && di_phdl) {
len = di_prom_prop_lookup_ints(di_phdl, args.node,
"assigned-addresses", &regbuf);
}
#endif
}
if (len <= 0)
@ -845,6 +905,70 @@ pci_device_solx_devfs_probe( struct pci_device * dev )
return (err);
}
/**
* Map a memory region for a device using /dev/xsvc.
*
* \param dev Device whose memory region is to be mapped.
* \param map Parameters of the mapping that is to be created.
*
* \return
* Zero on success or an \c errno value on failure.
*/
static int
pci_device_solx_devfs_map_range(struct pci_device *dev,
struct pci_device_mapping *map)
{
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? (PROT_READ | PROT_WRITE) : PROT_READ;
int err = 0;
#ifdef __sparc
char map_dev[128];
int map_fd;
if (MAPPING_DEV_PATH(dev))
snprintf(map_dev, sizeof (map_dev), "%s%s", "/devices", MAPPING_DEV_PATH(dev));
else
strcpy (map_dev, "/dev/fb0");
if ((map_fd = open(map_dev, O_RDWR)) < 0) {
err = errno;
(void) fprintf(stderr, "can not open %s: %s\n", map_dev,
strerror(errno));
return err;
}
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, map_fd, map->base);
#else
/*
* Still used xsvc to do the user space mapping
*/
if (xsvc_fd < 0) {
if ((xsvc_fd = open("/dev/xsvc", O_RDWR)) < 0) {
err = errno;
(void) fprintf(stderr, "can not open /dev/xsvc: %s\n",
strerror(errno));
return err;
}
}
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, xsvc_fd, map->base);
#endif
if (map->memory == MAP_FAILED) {
err = errno;
(void) fprintf(stderr, "map rom region =%llx failed: %s\n",
map->base, strerror(errno));
}
#ifdef __sparc
close (map_fd);
#endif
return err;
}
/*
* Solaris version: read the VGA ROM data
*/
@ -880,7 +1004,13 @@ pci_device_solx_devfs_read( struct pci_device * dev, void * data,
pcitool_reg_t cfg_prg;
int err = 0;
int i = 0;
nexus_t *nexus = find_nexus_for_bus(dev->bus);
nexus_t *nexus;
#ifdef __sparc
nexus = find_nexus_for_dev(dev);
#else
nexus = find_nexus_for_bus(dev->domain, dev->bus);
#endif
*bytes_read = 0;
@ -932,7 +1062,13 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
pcitool_reg_t cfg_prg;
int err = 0;
int cmd;
nexus_t *nexus = find_nexus_for_bus(dev->bus);
nexus_t *nexus;
#ifdef __sparc
nexus = find_nexus_for_dev(dev);
#else
nexus = find_nexus_for_bus(dev->domain, dev->bus);
#endif
if ( bytes_written != NULL ) {
*bytes_written = 0;
@ -946,15 +1082,19 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
switch (size) {
case 1:
cfg_prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_1 + NATIVE_ENDIAN;
cfg_prg.data = *((const uint8_t *)data);
break;
case 2:
cfg_prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_2 + NATIVE_ENDIAN;
cfg_prg.data = *((const uint16_t *)data);
break;
case 4:
cfg_prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_4 + NATIVE_ENDIAN;
cfg_prg.data = *((const uint32_t *)data);
break;
case 8:
cfg_prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_8 + NATIVE_ENDIAN;
cfg_prg.data = *((const uint64_t *)data);
break;
default:
return EINVAL;
@ -964,7 +1104,6 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
cfg_prg.func_no = dev->func;
cfg_prg.barnum = 0;
cfg_prg.user_version = PCITOOL_USER_VERSION;
cfg_prg.data = *((uint64_t *)data);
/*
* Check if this device is bridge device.
@ -984,42 +1123,72 @@ pci_device_solx_devfs_write( struct pci_device * dev, const void * data,
}
/**
* Map a memory region for a device using /dev/xsvc.
*
* \param dev Device whose memory region is to be mapped.
* \param map Parameters of the mapping that is to be created.
*
* \return
* Zero on success or an \c errno value on failure.
static const struct pci_system_methods solx_devfs_methods = {
.destroy = pci_system_solx_devfs_destroy,
.destroy_device = NULL,
.read_rom = pci_device_solx_devfs_read_rom,
.probe = pci_device_solx_devfs_probe,
.map_range = pci_device_solx_devfs_map_range,
.unmap_range = pci_device_generic_unmap_range,
.read = pci_device_solx_devfs_read,
.write = pci_device_solx_devfs_write,
.fill_capabilities = pci_fill_capabilities_generic
};
/*
* Attempt to access PCI subsystem using Solaris's devfs interface.
* Solaris version
*/
static int
pci_device_solx_devfs_map_range(struct pci_device *dev,
struct pci_device_mapping *map)
_pci_hidden int
pci_system_solx_devfs_create( void )
{
const int prot = ((map->flags & PCI_DEV_MAP_FLAG_WRITABLE) != 0)
? (PROT_READ | PROT_WRITE) : PROT_READ;
int err = 0;
di_node_t di_node;
probe_info_t pinfo;
struct pci_device_private *devices;
/*
* Still used xsvc to do the user space mapping
*/
if (xsvc_fd < 0) {
if ((xsvc_fd = open("/dev/xsvc", O_RDWR)) < 0) {
err = errno;
(void) fprintf(stderr, "can not open /dev/xsvc: %s\n",
strerror(errno));
return err;
}
if (nexus_list != NULL) {
return 0;
}
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, xsvc_fd, map->base);
if (map->memory == MAP_FAILED) {
if ((di_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) {
err = errno;
(void) fprintf(stderr, "map rom region =%llx failed: %s\n",
map->base, strerror(errno));
(void) fprintf(stderr, "di_init() failed: %s\n",
strerror(errno));
return (err);
}
return err;
if ((devices = calloc(INITIAL_NUM_DEVICES,
sizeof (struct pci_device_private))) == NULL) {
err = errno;
di_fini(di_node);
return (err);
}
#ifdef __sparc
if ((di_phdl = di_prom_init()) == DI_PROM_HANDLE_NIL)
(void) fprintf(stderr, "di_prom_init failed: %s\n", strerror(errno));
#endif
pinfo.num_allocated_elems = INITIAL_NUM_DEVICES;
pinfo.num_devices = 0;
pinfo.devices = devices;
(void) di_walk_minor(di_node, DDI_NT_REGACC, 0, &pinfo, probe_nexus_node);
di_fini(di_node);
if ((pci_sys = calloc(1, sizeof (struct pci_system))) == NULL) {
err = errno;
free(devices);
return (err);
}
pci_sys->methods = &solx_devfs_methods;
pci_sys->devices = pinfo.devices;
pci_sys->num_devices = pinfo.num_devices;
return (err);
}