Hello community,
here is the log from the commit of package biosdevname for openSUSE:Factory checked in at 2012-12-07 14:06:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/biosdevname (Old)
and /work/SRC/openSUSE:Factory/.biosdevname.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "biosdevname", Maintainer is "duwe@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/biosdevname/biosdevname.changes 2012-09-14 12:14:38.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.biosdevname.new/biosdevname.changes 2012-12-07 14:06:59.000000000 +0100
@@ -1,0 +2,8 @@
+Mon Dec 3 13:51:01 UTC 2012 - p.drouand@gmail.com
+
+- Update to 0.4.1 version:
+ * Use addslot() to track both embedded and physical index per slot
+ * Add fixes to ignore NPAR parsing on some cards
+- Removed patchs: more-cmdline-args, verify-network-VPD, bug-706505
+ fixed on upstream releases bnc#706505
+-------------------------------------------------------------------
Old:
----
biosdevname-0.3.8.tar.gz
bug-706505
more-cmdline-args
verify-network-VPD
New:
----
biosdevname-0.4.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ biosdevname.spec ++++++
--- /var/tmp/diff_new_pack.enaMkx/_old 2012-12-07 14:07:01.000000000 +0100
+++ /var/tmp/diff_new_pack.enaMkx/_new 2012-12-07 14:07:01.000000000 +0100
@@ -17,7 +17,7 @@
Name: biosdevname
-Version: 0.3.8
+Version: 0.4.1
Release: 0
Summary: Udev helper for naming devices per BIOS names
License: GPL-2.0
@@ -30,11 +30,8 @@
ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1: setup-biosdevname.sh
-Patch1: more-cmdline-args
Patch2: ignore-broken-BIOSes
Patch3: whitelist-dell
-Patch4: verify-network-VPD
-Patch5: bug-706505
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: pciutils-devel
BuildRequires: zlib-devel
@@ -57,11 +54,8 @@
%prep
%setup -q
-%patch1 -p1
%patch2 -p1
%patch3 -p1
-%patch4 -p1
-%patch5 -p1
%build
# this is a udev rule, so it needs to live in / rather than /usr
++++++ biosdevname-0.3.8.tar.gz -> biosdevname-0.4.1.tar.gz ++++++
++++ 4513 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/ChangeLog new/biosdevname-0.4.1/ChangeLog
--- old/biosdevname-0.3.8/ChangeLog 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/ChangeLog 2012-07-05 21:33:22.000000000 +0200
@@ -1,3 +1,7 @@
+* Mon Jul 1 2012
+- Use addslot() to track both embedded and physical index per slot
+- Add fixes to ignore NPAR parsing on some cards
+
* Mon Jul 27 2009
- add SMBIOS naming policy
- fix return error check for mmap
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/INSTALL new/biosdevname-0.4.1/INSTALL
--- old/biosdevname-0.3.8/INSTALL 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/INSTALL 2012-07-05 21:35:01.000000000 +0200
@@ -1,8 +1,8 @@
Installation Instructions
*************************
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
@@ -10,10 +10,7 @@
Basic Installation
==================
-Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package. The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -26,9 +23,9 @@
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. Caching is
+the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
-cache files.
+cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
@@ -38,17 +35,20 @@
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
- Running `configure' might take a while. While running, it prints
- some messages telling which features it is checking for.
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -78,7 +78,7 @@
by setting variables in the command line or in the environment. Here
is an example:
- ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
@@ -87,15 +87,17 @@
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you can use GNU `make'. `cd' to the
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory. After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
Installation Names
==================
@@ -188,12 +190,12 @@
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
+overridden in the site shell script). Here is a another example:
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/biosdevname.1 new/biosdevname-0.4.1/biosdevname.1
--- old/biosdevname-0.3.8/biosdevname.1 2011-03-15 19:50:55.000000000 +0100
+++ new/biosdevname-0.4.1/biosdevname.1 2012-06-14 21:38:30.000000000 +0200
@@ -35,6 +35,13 @@
.TP
.B \-\-prefix \fI[string]
string use for embedded NICs in the physical policy (default=em)
+.TP
+.B \-\-nopirq
+Do not use $PIR table for mapping PCI device to slot. Some BIOS have
+incorrect values.
+.TP
+.B \-\-smbios \fI[x.y]
+Require minimum SMBIOS version x.y
.SH POLICIES
.br
The
@@ -47,10 +54,10 @@
.B physical
policy uses the following scheme:
.TP
-em<port>
+em<port>[_<virtual instance>]
for embedded NICs
.TP
-pci<slot>#<port>_<virtual instance>
+p<slot>p<port>[_<virtual instance>]
for cards in PCI slots
.br
.TP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/biosdevname.spec.fedora new/biosdevname-0.4.1/biosdevname.spec.fedora
--- old/biosdevname-0.3.8/biosdevname.spec.fedora 2011-03-16 18:44:09.000000000 +0100
+++ new/biosdevname-0.4.1/biosdevname.spec.fedora 2012-07-05 21:35:26.000000000 +0200
@@ -1,5 +1,5 @@
Name: biosdevname
-Version: 0.3.8
+Version: 0.4.1
Release: 1%{?dist}
Summary: Udev helper for naming devices per BIOS names
@@ -9,12 +9,15 @@
# SMBIOS only exists on these arches. It's also likely that other
# arches don't expect the PCI bus to be sorted breadth-first, or of
# so, there haven't been any comments about that on LKML.
-ExclusiveArch: %{ix86} x86_64 ia64
+ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/permalink/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: pciutils-devel, zlib-devel
# to figure out how to name the rules file
BuildRequires: udev
+#To generate the configure script
+BuildRequires: autoconf
+BuildRequires: automake
# for ownership of /etc/udev/rules.d
Requires: udev
@@ -29,6 +32,10 @@
%setup -q
%build
+#If configure script doesn't exist generate it with autogen script
+[ -e ./configure ] || ./autogen.sh --no-configure
+
+
# this is a udev rule, so it needs to live in / rather than /usr
%configure --disable-rpath --prefix=/ --sbindir=/sbin
make %{?_smp_mflags}
@@ -51,6 +58,21 @@
%changelog
+* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-1
+- Fix man page for PCI slot naming
+- Fix clearing of buffer for NPAR/SRIOV naming
+- Add --nopirq and --smbios options to manpage.
+- Verify length of VPD on network device
+- Close file handle on sysfs read
+- Fix naming policy for NPAR devices.
+ Match each PCI device to its VPD 'physical' device to get correct index
+- Exclude building on ia64 arch
+- Add support functions for determining PCIE slot
+- Scan full path to parent when getting PCIE slot
+- Fix NPAR naming for add-in cards
+- Don't display _vf suffix on NPAR devices with single function
+- Fix PCIe/PIRQ slot mapping
+
* Thu Feb 17 2011 Matt Domsch - 0.3.7-1
- drop dump_pirq, suggest use biosdecode instead
- don't use '#' in names, use 'p' instead, by popular demand
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/biosdevname.spec.fedora.in new/biosdevname-0.4.1/biosdevname.spec.fedora.in
--- old/biosdevname-0.3.8/biosdevname.spec.fedora.in 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/biosdevname.spec.fedora.in 2012-06-14 21:38:30.000000000 +0200
@@ -9,12 +9,15 @@
# SMBIOS only exists on these arches. It's also likely that other
# arches don't expect the PCI bus to be sorted breadth-first, or of
# so, there haven't been any comments about that on LKML.
-ExclusiveArch: %{ix86} x86_64 ia64
+ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/permalink/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: pciutils-devel, zlib-devel
# to figure out how to name the rules file
BuildRequires: udev
+#To generate the configure script
+BuildRequires: autoconf
+BuildRequires: automake
# for ownership of /etc/udev/rules.d
Requires: udev
@@ -29,6 +32,10 @@
%setup -q
%build
+#If configure script doesn't exist generate it with autogen script
+[ -e ./configure ] || ./autogen.sh --no-configure
+
+
# this is a udev rule, so it needs to live in / rather than /usr
%configure --disable-rpath --prefix=/ --sbindir=/sbin
make %{?_smp_mflags}
@@ -51,6 +58,21 @@
%changelog
+* Tue Oct 4 2011 Praveen K Paladugu - 0.3.11-1
+- Fix man page for PCI slot naming
+- Fix clearing of buffer for NPAR/SRIOV naming
+- Add --nopirq and --smbios options to manpage.
+- Verify length of VPD on network device
+- Close file handle on sysfs read
+- Fix naming policy for NPAR devices.
+ Match each PCI device to its VPD 'physical' device to get correct index
+- Exclude building on ia64 arch
+- Add support functions for determining PCIE slot
+- Scan full path to parent when getting PCIE slot
+- Fix NPAR naming for add-in cards
+- Don't display _vf suffix on NPAR devices with single function
+- Fix PCIe/PIRQ slot mapping
+
* Thu Feb 17 2011 Matt Domsch - 0.3.7-1
- drop dump_pirq, suggest use biosdecode instead
- don't use '#' in names, use 'p' instead, by popular demand
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/biosdevname.spec.suse new/biosdevname-0.4.1/biosdevname.spec.suse
--- old/biosdevname-0.3.8/biosdevname.spec.suse 2011-03-16 18:44:09.000000000 +0100
+++ new/biosdevname-0.4.1/biosdevname.spec.suse 2012-07-05 21:35:26.000000000 +0200
@@ -1,5 +1,5 @@
Name: biosdevname
-Version: 0.3.8
+Version: 0.4.1
Release: 1%{?dist}
Summary: Udev helper for naming devices per BIOS names
@@ -9,7 +9,7 @@
# SMBIOS only exists on these arches. It's also likely that other
# arches don't expect the PCI bus to be sorted breadth-first, or of
# so, there haven't been any comments about that on LKML.
-ExclusiveArch: %{ix86} x86_64 ia64
+ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/permalink/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: pciutils-devel, zlib-devel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/biosdevname.spec.suse.in new/biosdevname-0.4.1/biosdevname.spec.suse.in
--- old/biosdevname-0.3.8/biosdevname.spec.suse.in 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/biosdevname.spec.suse.in 2012-06-14 21:37:18.000000000 +0200
@@ -9,7 +9,7 @@
# SMBIOS only exists on these arches. It's also likely that other
# arches don't expect the PCI bus to be sorted breadth-first, or of
# so, there haven't been any comments about that on LKML.
-ExclusiveArch: %{ix86} x86_64 ia64
+ExclusiveArch: %{ix86} x86_64
Source0: http://linux.dell.com/files/%{name}/permalink/%{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: pciutils-devel, zlib-devel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/configure.ac new/biosdevname-0.4.1/configure.ac
--- old/biosdevname-0.3.8/configure.ac 2011-03-09 00:58:33.000000000 +0100
+++ new/biosdevname-0.4.1/configure.ac 2012-07-05 21:31:25.000000000 +0200
@@ -3,7 +3,7 @@
# vim:tw=0:ts=8:sw=8:et
AC_PREREQ(2.59)
-AC_INIT([biosdevname],[0.3.8],[Jordan_Hargrave@dell.com])
+AC_INIT([biosdevname],[0.4.1],[Jordan_Hargrave@dell.com])
AC_LANG([C])
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_SRCDIR([src/read_proc.c])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/missing new/biosdevname-0.4.1/missing
--- old/biosdevname-0.3.8/missing 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/missing 2012-07-05 21:35:01.000000000 +0200
@@ -1,9 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2005-06-08.21
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard , 1996.
@@ -33,8 +33,6 @@
fi
run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
@@ -46,7 +44,7 @@
msg="missing on your system"
-case $1 in
+case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
@@ -79,7 +77,6 @@
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
@@ -109,7 +106,7 @@
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
-case $1 in
+case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
@@ -138,7 +135,7 @@
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -167,7 +164,7 @@
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
- case $f in
+ case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@@ -195,8 +192,8 @@
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
@@ -217,25 +214,25 @@
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
- if test $# -ne 1; then
+ if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
- case $LASTARG in
+ case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
- if test ! -f y.tab.h; then
+ if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
- if test ! -f y.tab.c; then
+ if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
@@ -247,18 +244,18 @@
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
- if test $# -ne 1; then
+ if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
- case $LASTARG in
+ case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
- if test ! -f lex.yy.c; then
+ if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
@@ -270,9 +267,11 @@
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
@@ -290,17 +289,11 @@
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '
- /^@setfilename/{
- s/.* \([^ ]*\) *$/\1/
- p
- q
- }' $infile`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
@@ -324,13 +317,13 @@
fi
firstarg="$1"
if shift; then
- case $firstarg in
+ case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
- case $firstarg in
+ case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/bios_dev_name.c new/biosdevname-0.4.1/src/bios_dev_name.c
--- old/biosdevname-0.3.8/src/bios_dev_name.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/bios_dev_name.c 2012-06-14 21:38:30.000000000 +0200
@@ -14,6 +14,10 @@
#include "bios_dev_name.h"
static struct bios_dev_name_opts opts;
+int nopirq;
+int smver_mjr;
+int smver_mnr;
+int is_valid_smbios = 0;
static void usage(void)
{
@@ -23,6 +27,8 @@
fprintf(stderr, " -d or --debug enable debugging\n");
fprintf(stderr, " --policy [physical | all_ethN ]\n");
fprintf(stderr, " --prefix [string] string use for embedded NICs (default='em')\n");
+ fprintf(stderr, " --smbios [x.y] Require SMBIOS x.y or greater\n");
+ fprintf(stderr, " --nopirq Don't use $PIR table for slot numbers\n");
fprintf(stderr, " Example: biosdevname -i eth0\n");
fprintf(stderr, " returns: em1\n");
fprintf(stderr, " when eth0 is an embedded NIC with label '1' on the chassis.\n");
@@ -55,6 +61,8 @@
{"interface", no_argument, 0, 'i'},
{"policy", required_argument, 0, 'p'},
{"prefix", required_argument, 0, 'P'},
+ {"nopirq", no_argument, 0, 'x'},
+ {"smbios", required_argument, 0, 's'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv,
@@ -75,6 +83,12 @@
case 'P':
opts.prefix = optarg;
break;
+ case 's':
+ sscanf(optarg, "%u.%u", &smver_mjr, &smver_mnr);
+ break;
+ case 'x':
+ nopirq = 1;
+ break;
default:
usage();
exit(1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/bios_dev_name.h new/biosdevname-0.4.1/src/bios_dev_name.h
--- old/biosdevname-0.3.8/src/bios_dev_name.h 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/bios_dev_name.h 2012-06-14 21:38:30.000000000 +0200
@@ -13,8 +13,6 @@
int sortroutine;
int namingpolicy;
const char *prefix;
- unsigned int verbose:1;
- unsigned int show_all:1;
unsigned int debug:1;
unsigned int interface:1;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/bios_device.c new/biosdevname-0.4.1/src/bios_device.c
--- old/biosdevname-0.3.8/src/bios_device.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/bios_device.c 2012-06-19 23:42:38.000000000 +0200
@@ -153,6 +153,11 @@
else if (a->physical_slot > b->physical_slot) return 1;
}
+ /* Check if PCI devices are same, sort by ifindex */
+ if (a == b) {
+ if (x->netdev->ifindex < y->netdev->ifindex) return -1;
+ if (x->netdev->ifindex > y->netdev->ifindex) return 1;
+ }
return sort_pci(x, y);
}
@@ -207,6 +212,32 @@
list_splice(&sorted_devices, &state->bios_devices);
}
+static void match_pci_and_eth_devs(struct libbiosdevname_state *state)
+{
+ struct pci_device *p;
+ struct bios_device *b;
+ struct network_device *n;
+
+ list_for_each_entry(n, &state->network_devices, node) {
+ p = find_dev_by_pci_name(state, n->drvinfo.bus_info);
+ if (!p)
+ continue;
+
+ b = malloc(sizeof(*b));
+ if (!b)
+ continue;
+ memset(b, 0, sizeof(*b));
+ INIT_LIST_HEAD(&b->node);
+ b->pcidev = p;
+ b->netdev = n;
+ b->slot_num = -1;
+ b->port_num = -1;
+ claim_netdev(b->netdev);
+ list_add(&b->node, &state->bios_devices);
+ }
+}
+
+
static void match_eth_and_pci_devs(struct libbiosdevname_state *state)
{
struct pci_device *p;
@@ -230,6 +261,8 @@
INIT_LIST_HEAD(&b->node);
b->pcidev = p;
b->netdev = n;
+ b->slot_num = -1;
+ b->port_num = -1;
claim_netdev(b->netdev);
list_add(&b->node, &state->bios_devices);
}
@@ -253,6 +286,8 @@
memset(b, 0, sizeof(*b));
INIT_LIST_HEAD(&b->node);
b->netdev = n;
+ b->slot_num = -1;
+ b->port_num = -1;
list_add(&b->node, &state->bios_devices);
}
}
@@ -260,7 +295,7 @@
static void match_all(struct libbiosdevname_state *state)
{
- match_eth_and_pci_devs(state);
+ match_pci_and_eth_devs(state);
match_unknown_eths(state);
}
@@ -273,6 +308,7 @@
INIT_LIST_HEAD(&state->bios_devices);
INIT_LIST_HEAD(&state->pci_devices);
INIT_LIST_HEAD(&state->network_devices);
+ INIT_LIST_HEAD(&state->slots);
state->pacc = NULL;
state->pirq_table = NULL;
return state;
@@ -319,6 +355,26 @@
}
}
+extern int addslot(struct libbiosdevname_state *state, int slot);
+
+/* Fix for RHBZ 816536/757743/756164/: Cards with same PCI but multiple ports
+ * chelsio, mellanox */
+static void check_ports(struct libbiosdevname_state *state)
+{
+ struct pci_device *dev;
+ struct bios_device *a;
+
+ list_for_each_entry(a, &state->bios_devices, node) {
+ dev = a->pcidev;
+ if (dev == NULL || dev->is_sriov_virtual_function || dev->vpd_port != INT_MAX)
+ continue;
+ if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) {
+ a->slot_num = dev->physical_slot;
+ a->port_num = addslot(state, 0x1000 + dev->physical_slot);
+ }
+ }
+}
+
void * setup_bios_devices(int namingpolicy, const char *prefix)
{
int rc=1;
@@ -334,6 +390,7 @@
get_eths(state);
match_all(state);
sort_device_list(state);
+ check_ports(state);
rc = assign_bios_network_names(state, namingpolicy, prefix);
if (rc)
goto out;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/bios_device.h new/biosdevname-0.4.1/src/bios_device.h
--- old/biosdevname-0.3.8/src/bios_device.h 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/bios_device.h 2012-06-19 23:42:38.000000000 +0200
@@ -19,6 +19,9 @@
struct pci_device *pcidev;
char *bios_name;
int duplicate;
+
+ int slot_num;
+ int port_num;
};
static inline int is_pci(const struct bios_device *dev)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/dmidecode/dmidecode.c new/biosdevname-0.4.1/src/dmidecode/dmidecode.c
--- old/biosdevname-0.3.8/src/dmidecode/dmidecode.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/dmidecode/dmidecode.c 2012-06-19 23:42:38.000000000 +0200
@@ -40,6 +40,8 @@
#include "../pci.h"
#include "../naming_policy.h"
+extern int smver_mjr, smver_mnr, is_valid_smbios;
+
static const char *bad_index = "<BAD INDEX>";
/*
@@ -176,12 +178,33 @@
h->data=data;
}
+static int isvalidsmbios(int mjr, int mnr)
+{
+ if (!smver_mjr && !smver_mnr) {
+ is_valid_smbios = 1;
+ return 1;
+ }
+ if (mjr > smver_mjr) {
+ is_valid_smbios = 1;
+ return 1;
+ }
+ if ((mjr == smver_mjr) && (mnr >= smver_mnr)) {
+ is_valid_smbios = 1;
+ return 1;
+ }
+ return 0;
+}
+
static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, const struct libbiosdevname_state *state)
{
u8 *buf;
u8 *data;
int i=0;
+ /* Verify SMBIOS version */
+ if (!isvalidsmbios(ver >> 8, ver & 0xFF)) {
+ return;
+ }
if((buf=mem_chunk(base, len, devmem))==NULL)
{
#ifndef USE_MMAP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/eths.c new/biosdevname-0.4.1/src/eths.c
--- old/biosdevname-0.3.8/src/eths.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/eths.c 2012-06-14 21:38:30.000000000 +0200
@@ -34,6 +34,29 @@
return (buf);
}
+static int eths_get_ifindex(const char *devname, int *ifindex)
+{
+ int fd, err;
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name));
+
+ /* Open control socket. */
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("Cannot get control socket");
+ return 1;
+ }
+
+ err = ioctl(fd, SIOCGIFINDEX, &ifr);
+ if (!err) {
+ *ifindex = ifr.ifr_ifindex;
+ }
+ close(fd);
+ return err;
+}
+
static int eths_get_hwaddr(const char *devname, unsigned char *buf, int size, int *type)
{
int fd, err;
@@ -123,6 +146,7 @@
static void fill_eth_dev(struct network_device *dev)
{
int rc;
+ eths_get_ifindex(dev->kernel_name, &dev->ifindex);
eths_get_hwaddr(dev->kernel_name, dev->dev_addr, sizeof(dev->dev_addr), &dev->arphrd_type);
eths_get_permaddr(dev->kernel_name, dev->perm_addr, sizeof(dev->perm_addr));
rc = eths_get_info(dev->kernel_name, &dev->drvinfo);
@@ -167,6 +191,7 @@
if (!zero_mac(dev->perm_addr))
s += snprintf(s, size-(s-buf), "Permanent MAC: %s\n", pr_ether(buffer, sizeof(buffer), dev->perm_addr));
s += snprintf(s, size-(s-buf), "Assigned MAC : %s\n", pr_ether(buffer, sizeof(buffer), dev->dev_addr));
+ s += snprintf(s, size-(s-buf), "ifIndex: %d\n", dev->ifindex);
if (drvinfo_valid(dev)) {
s += snprintf(s, size-(s-buf), "Driver: %s\n", dev->drvinfo.driver);
s += snprintf(s, size-(s-buf), "Driver version: %s\n", dev->drvinfo.version);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/eths.h new/biosdevname-0.4.1/src/eths.h
--- old/biosdevname-0.3.8/src/eths.h 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/eths.h 2012-06-14 21:38:30.000000000 +0200
@@ -26,6 +26,7 @@
int drvinfo_valid;
int arphrd_type; /* e.g. ARPHDR_ETHER */
int hardware_claimed; /* true when recognized as PCI or PCMCIA and added to list of bios_devices */
+ int ifindex;
};
extern void get_eths(struct libbiosdevname_state *state);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/naming_policy.c new/biosdevname-0.4.1/src/naming_policy.c
--- old/biosdevname-0.3.8/src/naming_policy.c 2011-03-15 19:41:42.000000000 +0100
+++ new/biosdevname-0.4.1/src/naming_policy.c 2012-06-19 23:42:38.000000000 +0200
@@ -37,38 +37,43 @@
char interface[IFNAMSIZ];
unsigned int portnum=0;
int known=0;
-
- memset(buffer, 0, sizeof(buffer));
- memset(location, 0, sizeof(location));
- memset(port, 0, sizeof(port));
- memset(interface, 0, sizeof(interface));
+ struct pci_device *vf;
list_for_each_entry(dev, &state->bios_devices, node) {
known = 0;
+ memset(buffer, 0, sizeof(buffer));
+ memset(location, 0, sizeof(location));
+ memset(port, 0, sizeof(port));
+ memset(interface, 0, sizeof(interface));
+
if (is_pci(dev)) {
+ vf = dev->pcidev;
if (dev->pcidev->physical_slot == 0) { /* embedded devices only */
- if (dev->pcidev->uses_sysfs & HAS_SYSFS_INDEX) {
- portnum = dev->pcidev->sysfs_index;
- snprintf(location, sizeof(location), "%s%u", prefix, portnum);
- known=1;
- }
- else if (dev->pcidev->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(dev->pcidev)) {
- portnum = dev->pcidev->smbios_instance;
- snprintf(location, sizeof(location), "%s%u", prefix, portnum);
- known=1;
- }
- else if (dev->pcidev->embedded_index_valid) {
- portnum = dev->pcidev->embedded_index;
+ portnum = INT_MAX;
+ /* Use master VPD device if available */
+ if (vf->vpd_pf)
+ vf = vf->vpd_pf;
+ if (vf->pf)
+ vf = vf->pf;
+ if (vf->uses_sysfs & HAS_SYSFS_INDEX)
+ portnum = vf->sysfs_index;
+ else if (vf->uses_smbios & HAS_SMBIOS_INSTANCE && is_pci_smbios_type_ethernet(vf))
+ portnum = vf->smbios_instance;
+ else if (dev->port_num != -1)
+ portnum = dev->port_num;
+ if (portnum != INT_MAX) {
snprintf(location, sizeof(location), "%s%u", prefix, portnum);
known=1;
}
}
else if (dev->pcidev->physical_slot < PHYSICAL_SLOT_UNKNOWN) {
snprintf(location, sizeof(location), "p%u", dev->pcidev->physical_slot);
- if (!dev->pcidev->is_sriov_virtual_function)
- portnum = dev->pcidev->index_in_slot;
- else if (dev->pcidev->vpd_port < INT_MAX)
+ if (dev->pcidev->vpd_port < INT_MAX)
portnum = dev->pcidev->vpd_port;
+ else if (dev->port_num != -1)
+ portnum = dev->port_num;
+ else if (!dev->pcidev->is_sriov_virtual_function)
+ portnum = dev->pcidev->index_in_slot;
else
portnum = dev->pcidev->pf->index_in_slot;
snprintf(port, sizeof(port), "p%u", portnum);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/pci.c new/biosdevname-0.4.1/src/pci.c
--- old/biosdevname-0.3.8/src/pci.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/pci.c 2012-06-19 23:42:38.000000000 +0200
@@ -21,6 +21,12 @@
#include "dmidecode/dmidecode.h"
#include "pirq.h"
+extern int is_valid_smbios;
+
+#ifndef PCI_CB_CAPABILITY_LIST
+#define PCI_CB_CAPABILITY_LIST 0x14
+#endif
+
/* Borrowed from kernel vpd code */
#define PCI_VPD_LRDT 0x80
#define PCI_VPD_SRDT_END 0x78
@@ -45,6 +51,32 @@
return info_field[2];
}
+static int pci_vpd_size(struct pci_device *pdev, int fd)
+{
+ uint8_t buf[3], tag;
+ int off;
+
+ if (!is_pci_network(pdev))
+ return 0;
+ off = 0;
+ for(;;) {
+ if (pread(fd, buf, 1, off) != 1)
+ break;
+ if (buf[0] & PCI_VPD_LRDT) {
+ tag = buf[0];
+ if (pread(fd, buf, 3, off) != 3)
+ break;
+ off += PCI_VPD_LRDT_TAG_SIZE + pci_vpd_lrdt_size(buf);
+ } else {
+ tag = buf[0] & ~PCI_VPD_SRDT_LEN_MASK;
+ off += PCI_VPD_SRDT_TAG_SIZE + pci_vpd_srdt_size(buf);
+ }
+ if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END)
+ break;
+ }
+ return off;
+}
+
static int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt)
{
int i;
@@ -88,9 +120,10 @@
return -1;
}
-static int parse_vpd(struct pci_device *pdev, int len, unsigned char *vpd)
+static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev, int len, unsigned char *vpd)
{
int i, j, k, isz, jsz, port, func, pfi;
+ struct pci_device *vf;
i = pci_vpd_find_tag(vpd, 0, len, 0x90);
if (i < 0)
@@ -107,15 +140,6 @@
if (memcmp(vpd+j+3, "1028VPDR.VER1.0", 15))
return 1;
- /* Lookup NPY Num Ports */
- j = pci_vpd_find_info_subkey(vpd, i, isz, "**", "NPY");
- if (j < 0)
- return 1;
- jsz = pci_vpd_info_field_size(&vpd[j]);
- j += PCI_VPD_INFO_FLD_HDR_SIZE;
- sscanf((char *)vpd+j+3, "%1x", &port);
- pdev->vpd_nports = port;
-
/* Lookup Port Mappings */
j = pci_vpd_find_info_subkey(vpd, i, isz, "**", "DCM");
if (j < 0)
@@ -126,16 +150,21 @@
for (k=3; kpci_dev->func) {
- pdev->vpd_port = port;
- pdev->vpd_pfi = pfi;
+ if ((vf = find_pci_dev_by_pci_addr(state, pdev->pci_dev->domain,
+ pdev->pci_dev->bus,
+ pdev->pci_dev->dev,
+ func)) != NULL) {
+ if (vf->vpd_port == INT_MAX) {
+ vf->vpd_port = port;
+ vf->vpd_pfi = pfi;
+ }
}
}
return 0;
}
/* Read and parse PCI VPD section if it exists */
-static int read_pci_vpd(struct pci_device *pdev)
+static int read_pci_vpd(struct libbiosdevname_state *state, struct pci_device *pdev)
{
char path[PATH_MAX];
char pci_name[16];
@@ -146,13 +175,15 @@
unparse_pci_name(pci_name, sizeof(pci_name), pdev->pci_dev);
snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/vpd", pci_name);
- if ((fd = open(path, O_RDONLY)) >= 0) {
- size = lseek(fd, 0, SEEK_END);
- vpd = malloc(size);
- if (vpd != NULL) {
- if ((nrd = pread(fd, vpd, size, 0)) > 0)
- rc = parse_vpd(pdev, nrd, vpd);
- free(vpd);
+ if ((fd = open(path, O_RDONLY|O_SYNC)) >= 0) {
+ size = pci_vpd_size(pdev, fd);
+ if (size > 0) {
+ vpd = malloc(size);
+ if (vpd != NULL) {
+ if ((nrd = pread(fd, vpd, size, 0)) > 0)
+ rc = parse_vpd(state, pdev, nrd, vpd);
+ free(vpd);
+ }
}
close(fd);
}
@@ -161,11 +192,110 @@
static void set_pci_vpd_instance(struct libbiosdevname_state *state)
{
- struct pci_device *dev;
+ struct pci_device *dev, *dev2;
+ int fd;
+ char sys_vendor[10] = {0};
+
+ /* Read VPD-R on Dell systems only */
+ if ((fd = open("/sys/devices/virtual/dmi/id/sys_vendor", O_RDONLY)) >= 0) {
+ if (read(fd, sys_vendor, 9) != 9)
+ return;
+ if (strncmp(sys_vendor, "Dell Inc.", 9))
+ return;
+ } else
+ return;
+
+ /* Read VPD information for each device */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ /* RedHat bugzilla 801885, 789635, 781572 */
+ if (dev->pci_dev->vendor_id == 0x1969 ||
+ dev->pci_dev->vendor_id == 0x168c)
+ continue;
+ read_pci_vpd(state, dev);
+ }
+
+ /* Now match VPD master device */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ if (dev->vpd_port == INT_MAX)
+ continue;
+ list_for_each_entry(dev2, &state->pci_devices, node) {
+ if (dev2->pci_dev->domain == dev->pci_dev->domain &&
+ dev2->pci_dev->bus == dev->pci_dev->bus &&
+ dev2->pci_dev->dev == dev->pci_dev->dev &&
+ dev2->vpd_port == dev->vpd_port) {
+ dev2->vpd_count++;
+ dev->vpd_pf = dev2;
+ break;
+ }
+ }
+ }
+ /* Delete all VPD devices with single function */
list_for_each_entry(dev, &state->pci_devices, node) {
- read_pci_vpd(dev);
+ if (dev->vpd_count == 1) {
+ dev->vpd_port = INT_MAX;
+ dev->vpd_pfi = INT_MAX;
+ dev->vpd_pf = NULL;
+ }
+ }
+}
+
+static int pci_find_capability(struct pci_dev *p, int cap)
+{
+ u16 status;
+ u8 hdr, id;
+ int pos, ttl = 48;
+
+ status = pci_read_word(p, PCI_STATUS);
+ if (!(status & PCI_STATUS_CAP_LIST))
+ return 0;
+ hdr = pci_read_byte(p, PCI_HEADER_TYPE);
+ switch(hdr & 0x7F) {
+ case PCI_HEADER_TYPE_NORMAL:
+ case PCI_HEADER_TYPE_BRIDGE:
+ pos = PCI_CAPABILITY_LIST;
+ break;
+ case PCI_HEADER_TYPE_CARDBUS:
+ pos = PCI_CB_CAPABILITY_LIST;
+ break;
+ default:
+ return 0;
+ }
+
+ while (ttl--) {
+ pos = pci_read_byte(p, pos);
+ if (pos < 0x40)
+ break;
+ pos &= ~3;
+ id = pci_read_byte(p, pos+PCI_CAP_LIST_ID);
+ if (id == 0xFF)
+ break;
+ if (id == cap)
+ return pos;
+ pos += PCI_CAP_LIST_NEXT;
+ }
+ return 0;
+}
+
+static struct pci_device *
+find_parent(struct libbiosdevname_state *state, struct pci_device *dev);
+
+static int pcie_get_slot(struct libbiosdevname_state *state, struct pci_device *p)
+{
+ int pos;
+ u32 slot, flag;
+
+ while (p) {
+ /* Return PCIE physical slot number */
+ if ((pos = pci_find_capability(p->pci_dev, PCI_CAP_ID_EXP)) != 0) {
+ flag = pci_read_word(p->pci_dev, pos + PCI_EXP_FLAGS);
+ slot = (pci_read_long(p->pci_dev, pos + PCI_EXP_SLTCAP) >> 19);
+ if ((flag & PCI_EXP_FLAGS_SLOT) && slot)
+ return slot;
+ }
+ p = find_parent(state, p);
}
+ return PHYSICAL_SLOT_UNKNOWN;
}
static int read_pci_sysfs_path(char *buf, size_t bufsize, const struct pci_dev *pdev)
@@ -385,6 +515,8 @@
int slot;
do {
slot = pci_dev_to_slot(state, d);
+ if (slot == PHYSICAL_SLOT_UNKNOWN && is_valid_smbios)
+ slot = pcie_get_slot(state, d);
if (slot == PHYSICAL_SLOT_UNKNOWN)
slot = pirq_dev_to_slot(state, d);
if (slot == PHYSICAL_SLOT_UNKNOWN)
@@ -448,6 +580,7 @@
}
}
+
static void add_pci_dev(struct libbiosdevname_state *state,
struct pci_dev *p)
{
@@ -467,6 +600,7 @@
dev->vf_index = INT_MAX;
dev->vpd_port = INT_MAX;
dev->vpd_pfi = INT_MAX;
+ dev->vpd_pf = NULL;
fill_pci_dev_sysfs(dev, p);
list_add(&dev->node, &state->pci_devices);
}
@@ -484,58 +618,44 @@
}
}
-static void set_pci_slots(struct libbiosdevname_state *state)
+int addslot(struct libbiosdevname_state *state, int slot)
{
- struct pci_device *dev;
+ struct slotlist *s;
- list_for_each_entry(dev, &state->pci_devices, node) {
- dev_to_slot(state, dev);
+ list_for_each_entry(s, &state->slots, node) {
+ if (s->slot == slot) {
+ return ++s->count;
+ }
}
-}
+ s = malloc(sizeof(*s));
+ INIT_LIST_HEAD(&s->node);
+ s->slot = slot;
+ s->count = 0;
+ list_add(&s->node, &state->slots);
-
-static int set_pci_slot_index(struct libbiosdevname_state *state)
-{
- struct pci_device *pcidev;
- int prevslot=-1;
- int index=1;
-
- /* only iterate over the PCI devices, because the bios_device list may be incomplete due to renames happening in parallel */
- list_for_each_entry(pcidev, &state->pci_devices, node) {
- if (pcidev->physical_slot == 0) /* skip embedded devices */
- continue;
- if (!is_pci_network(pcidev)) /* only look at PCI network devices */
- continue;
- if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */
- continue;
- if (pcidev->physical_slot != prevslot) {
- index=1;
- prevslot = pcidev->physical_slot;
- }
- else
- index++;
- pcidev->index_in_slot = index;
- }
- return 0;
+ return ++s->count;
}
-static int set_embedded_index(struct libbiosdevname_state *state)
+static void set_pci_slots(struct libbiosdevname_state *state)
{
- struct pci_device *pcidev;
- int index=1;
+ struct pci_device *dev;
- list_for_each_entry(pcidev, &state->pci_devices, node) {
- if (pcidev->physical_slot != 0) /* skip non-embedded devices */
- continue;
- if (!is_pci_network(pcidev)) /* only look at PCI network devices */
- continue;
- if (pcidev->is_sriov_virtual_function) /* skip sriov VFs, they're handled later */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ dev_to_slot(state, dev);
+ }
+
+ /* Get mapping for each slot */
+ list_for_each_entry(dev, &state->pci_devices, node) {
+ if (dev->is_sriov_virtual_function || !is_pci_network(dev) || dev->vpd_port != INT_MAX) {
continue;
- pcidev->embedded_index = index;
- pcidev->embedded_index_valid = 1;
- index++;
+ }
+ if (dev->physical_slot == 0) {
+ dev->embedded_index_valid = 1;
+ dev->embedded_index = addslot(state, 0);
+ } else if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) {
+ dev->index_in_slot = addslot(state, dev->physical_slot);
+ }
}
- return 0;
}
static void set_sriov_pf_vf(struct libbiosdevname_state *state)
@@ -616,11 +736,9 @@
/* ordering here is important */
dmidecode_main(state); /* this will fail on Xen guests, that's OK */
sort_device_list(state);
+ set_pci_vpd_instance(state);
set_pci_slots(state);
- set_embedded_index(state);
- set_pci_slot_index(state);
set_sriov_pf_vf(state);
- set_pci_vpd_instance(state);
return rc;
}
@@ -683,8 +801,8 @@
if (p->smbios_type) {
s += snprintf(s, size-(s-buf), "SMBIOS Device Type: ");
s += unparse_smbios_type41_type(s, size-(s-buf), p->smbios_type);
- s += snprintf(s, size-(s-buf), "SMBIOS Instance: %u\n", p->smbios_instance);
- s += snprintf(s, size-(s-buf), "SMBIOS Enabled: %s\n", p->smbios_instance?"True":"False");
+ if (p->smbios_instance)
+ s += snprintf(s, size-(s-buf), "SMBIOS Instance: %u\n", p->smbios_instance);
}
if (p->uses_smbios & HAS_SMBIOS_LABEL && p->smbios_label)
s += snprintf(s, size-(s-buf), "SMBIOS Label: %s\n", p->smbios_label);
@@ -699,7 +817,11 @@
if (p->vpd_port < INT_MAX) {
s += snprintf(s, size-(s-buf), "VPD Port: %u\n", p->vpd_port);
s += snprintf(s, size-(s-buf), "VPD Index: %u\n", p->vpd_pfi);
- s += snprintf(s, size-(s-buf), "VPD #Ports: %u\n", p->vpd_nports);
+ if (p->vpd_pf) {
+ s += snprintf(s, size-(s-buf), "VPD PCI master: ");
+ s += unparse_pci_name(s, size-(s-buf), p->vpd_pf->pci_dev);
+ s += snprintf(s, size-(s-buf), " count %d\n", p->vpd_pf->vpd_count);
+ }
}
if (!list_empty(&p->vfs)) {
s += snprintf(s, size-(s-buf), "Virtual Functions:\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/pci.h new/biosdevname-0.4.1/src/pci.h
--- old/biosdevname-0.3.8/src/pci.h 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/pci.h 2012-06-19 23:42:38.000000000 +0200
@@ -13,6 +13,13 @@
#include "state.h"
#include "config.h"
+struct slotlist
+{
+ struct list_head node;
+ int slot;
+ int count;
+};
+
struct pci_device {
struct list_head node;
struct pci_dev *pci_dev;
@@ -29,9 +36,10 @@
char * sysfs_label;
unsigned char uses_sysfs;
unsigned int vf_index;
+ unsigned int vpd_count;
unsigned int vpd_pfi;
- unsigned int vpd_nports;
unsigned int vpd_port;
+ struct pci_device *vpd_pf;
struct pci_device *pf;
struct list_head vfnode;
struct list_head vfs;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/pirq.c new/biosdevname-0.4.1/src/pirq.c
--- old/biosdevname-0.3.8/src/pirq.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/pirq.c 2012-06-14 21:37:18.000000000 +0200
@@ -18,6 +18,8 @@
#include
#include "pirq.h"
+extern int nopirq;
+
/* If unknown, use INT_MAX so they get sorted last */
int pirq_pci_dev_to_slot(struct routing_table *table, int domain, int bus, int dev)
{
@@ -33,8 +35,11 @@
for (i=0; islot[i];
if (slot->bus == bus &&
- PCI_DEVICE(slot->device) == dev)
+ PCI_DEVICE(slot->device) == dev) {
+ if (slot->slot >= '1' && slot->slot <= '9')
+ return slot->slot - '0';
return slot->slot;
+ }
}
return INT_MAX;
}
@@ -49,8 +54,13 @@
int i;
void *mem;
off_t offset=0L;
- int fd=open("/dev/mem", O_RDONLY);
+ int fd;
+ /* Skip PIRQ table parsing */
+ if (nopirq) {
+ return NULL;
+ }
+ fd = open("/dev/mem", O_RDONLY);
if(fd==-1)
return NULL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/state.h new/biosdevname-0.4.1/src/state.h
--- old/biosdevname-0.3.8/src/state.h 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/state.h 2012-06-19 23:42:38.000000000 +0200
@@ -14,6 +14,7 @@
struct list_head bios_devices;
struct list_head pci_devices;
struct list_head network_devices;
+ struct list_head slots;
struct pci_access *pacc;
struct routing_table *pirq_table;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/biosdevname-0.3.8/src/sysfs.c new/biosdevname-0.4.1/src/sysfs.c
--- old/biosdevname-0.3.8/src/sysfs.c 2011-03-09 00:58:08.000000000 +0100
+++ new/biosdevname-0.4.1/src/sysfs.c 2012-06-14 21:37:18.000000000 +0200
@@ -50,8 +50,9 @@
}
length = read(fd, result, resultsize-1);
+ close(fd);
+
if (length < 0) {
- close(fd);
ret = -1;
goto free_out;
}
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org