From 27aec8bef61afdcd53b497709dd53bba8224eae3 Mon Sep 17 00:00:00 2001 From: Shane Wang Date: Sun, 22 Jan 2012 17:12:37 +0800 Subject: pciutils: upgrade to 3.1.9 (From OE-Core rev: 745bdcd3421747b050493079101f6f5ba7830daf) Signed-off-by: Shane Wang Signed-off-by: Richard Purdie --- .../pciutils/pciutils-3.1.9/configure.patch | 104 +++++++ .../pciutils/pciutils-3.1.9/guess-fix.patch | 37 +++ .../pciutils/pciutils-3.1.9/lib-build-fix.patch | 94 ++++++ .../pciutils/pciutils-3.1.9/makefile.patch | 14 + .../pciutils-3.1.9/pcimodules-pciutils.diff | 340 +++++++++++++++++++++ 5 files changed, 589 insertions(+) create mode 100644 meta/recipes-bsp/pciutils/pciutils-3.1.9/configure.patch create mode 100644 meta/recipes-bsp/pciutils/pciutils-3.1.9/guess-fix.patch create mode 100644 meta/recipes-bsp/pciutils/pciutils-3.1.9/lib-build-fix.patch create mode 100644 meta/recipes-bsp/pciutils/pciutils-3.1.9/makefile.patch create mode 100644 meta/recipes-bsp/pciutils/pciutils-3.1.9/pcimodules-pciutils.diff (limited to 'meta/recipes-bsp/pciutils/pciutils-3.1.9') diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.9/configure.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.9/configure.patch new file mode 100644 index 0000000000..658e59772c --- /dev/null +++ b/meta/recipes-bsp/pciutils/pciutils-3.1.9/configure.patch @@ -0,0 +1,104 @@ +Upstream-Status: Inappropriate [embedded specific] + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# +--- + +7/30/2010 - rebased to 3.1.5 by Qing He +1/22/2012 - rebased to 3.1.9 by Shane Wang + +diff -r af2b10cc3c14 Makefile +--- a/Makefile Sun Jan 22 18:36:34 2012 +0800 ++++ b/Makefile Sun Jan 22 18:38:54 2012 +0800 +@@ -37,7 +37,6 @@ + # Commands + INSTALL=install + DIRINSTALL=install -d +-STRIP=-s + CC=$(CROSS_COMPILE)gcc + AR=$(CROSS_COMPILE)ar + RANLIB=$(CROSS_COMPILE)ranlib +@@ -86,7 +85,7 @@ + example.o: example.c $(PCIINC) + + %: %.o +- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ ++ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@ + + %.8 %.7: %.man + M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@IDSDIR@#$(IDSDIR)#" +@@ -101,7 +100,7 @@ + install: all + # -c is ignored on Linux, but required on FreeBSD + $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7 +- $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR) ++ $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR) + $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8 +diff -r af2b10cc3c14 lib/configure +--- a/lib/configure Sun Jan 22 18:36:34 2012 +0800 ++++ b/lib/configure Sun Jan 22 18:38:54 2012 +0800 +@@ -14,6 +14,10 @@ + fi + } + ++VERSION=$1 ++IDSDIR=$2 ++DNS=yes ++ + if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then + echo >&2 "Please run the configure script from the top-level Makefile" + exit 1 +@@ -21,8 +25,8 @@ + + echo_n "Configuring libpci for your system..." + if [ -z "$HOST" ] ; then +- sys=`uname -s` +- rel=`uname -r` ++ sys=${3:-`uname -s`} ++ rel= + realsys="$sys" + if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ] + then +@@ -30,7 +34,7 @@ + proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1` + cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'` + else +- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'` ++ cpu=${4:-`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/`} + fi + if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ] + then +@@ -40,7 +44,7 @@ + then + sys=cygwin + fi +- HOST=${3:-$cpu-$sys} ++ HOST=$cpu-$sys + fi + [ -n "$RELEASE" ] && rel="${RELEASE}" + # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless. +@@ -49,6 +53,21 @@ + sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + echo " $host $rel $cpu $sys" + ++if [ "$host" = "linux--gnueabi" ] ++then ++ sys=linux ++fi ++ ++if [ "$host" = "linux--uclibc" ] ++then ++ sys=linux ++fi ++ ++if [ "$host" = "linux--uclibceabi" ] ++then ++ sys=linux ++fi ++ + c=config.h + m=config.mk + echo >$c '#define PCI_CONFIG_H' diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.9/guess-fix.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.9/guess-fix.patch new file mode 100644 index 0000000000..540b4a0d13 --- /dev/null +++ b/meta/recipes-bsp/pciutils/pciutils-3.1.9/guess-fix.patch @@ -0,0 +1,37 @@ +the original guess algorithm is broken for many archs +for example, the following two would break: + arm-linux-gnueabi --> sys=gnueabi + x86_64-unknown-pc-linux-gnu --> sys = pc-linux-gnu + +use a simpler scheme here and hope it works for all the cases + +Upstream-Status: Pending + +7/30/2010 - created by Qing He + +diff --git a/lib/configure b/lib/configure +index 4318b05..84f6acb 100755 +--- a/lib/configure ++++ b/lib/configure +@@ -53,20 +53,7 @@ cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + echo " $host $rel $cpu $sys" + +-if [ "$host" = "linux--gnueabi" ] +-then +- sys=linux +-fi +- +-if [ "$host" = "linux--uclibc" ] +-then +- sys=linux +-fi +- +-if [ "$host" = "linux--uclibceabi" ] +-then +- sys=linux +-fi ++{ echo "$host" | grep linux; } && sys=linux + + c=config.h + m=config.mk diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.9/lib-build-fix.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.9/lib-build-fix.patch new file mode 100644 index 0000000000..7268d531d9 --- /dev/null +++ b/meta/recipes-bsp/pciutils/pciutils-3.1.9/lib-build-fix.patch @@ -0,0 +1,94 @@ +Link directly to lib/libpci.so.3.1.5 will hard code this versioned +string into lspci and other utilities, which is not desirable and +won't work. In the other hand, linking to a symbolic link lib/libpci.so +doesn't have this issue. + +Upstream-Status: Pending + +7/30/2010 - created by Qing He + +diff --git a/Makefile b/Makefile +index 1b48e18..21af4b3 100644 +--- a/Makefile ++++ b/Makefile +@@ -51,9 +51,9 @@ PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h + + export + +-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8 ++all: lib/$(PCILIB_DEV) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8 + +-lib/$(PCILIB): $(PCIINC) force ++lib/$(PCILIB) lib/$(PCILIB_DEV): $(PCIINC) force + $(MAKE) -C lib all + + force: +@@ -61,9 +61,9 @@ force: + lib/config.h lib/config.mk: + cd lib && ./configure + +-pcimodules: pcimodules.o common.o lib/$(PCILIB) +-lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB) +-setpci: setpci.o common.o lib/$(PCILIB) ++pcimodules: pcimodules.o common.o lib/$(PCILIB_DEV) ++lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB_DEV) ++setpci: setpci.o common.o lib/$(PCILIB_DEV) + + pcimodules.o: pcimodules.c pciutils.h + LSPCIINC=lspci.h pciutils.h $(PCIINC) +@@ -83,7 +83,7 @@ update-pciids: update-pciids.sh + chmod +x $@ + + # The example of use of libpci +-example: example.o lib/$(PCILIB) ++example: example.o lib/$(PCILIB_DEV) + example.o: example.c $(PCIINC) + + %: %.o +diff --git a/lib/Makefile b/lib/Makefile +index 1eb06a5..a8dab56 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -42,7 +42,7 @@ ifdef PCI_HAVE_PM_NBSD_LIBPCI + OBJS += nbsd-libpci + endif + +-all: $(PCILIB) $(PCILIBPC) ++all: $(PCILIB_DEV) $(PCILIBPC) + + ifeq ($(SHARED),no) + $(PCILIB): $(addsuffix .o,$(OBJS)) +@@ -53,6 +53,9 @@ else + CFLAGS += -fPIC -fvisibility=hidden + $(PCILIB): $(addsuffix .o,$(OBJS)) + $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS) ++ ++$(PCILIB_DEV): $(PCILIB) ++ ln -s $< $@ + endif + + $(PCILIBPC): libpci.pc.in +diff --git a/lib/configure b/lib/configure +index eec225a..4318b05 100755 +--- a/lib/configure ++++ b/lib/configure +@@ -174,16 +193,18 @@ fi + echo "Checking whether to build a shared library... $SHARED (set manually)" + if [ "$SHARED" = no ] ; then + echo >>$m 'PCILIB=$(LIBNAME).a' ++ echo >>$m 'PCILIB_DEV=$(LIBNAME).a' + echo >>$m 'LDLIBS=$(WITH_LIBS)' + echo >>$m 'LIB_LDLIBS=' + else + echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)' ++ echo >>$m 'PCILIB_DEV=$(LIBNAME).so' + # We link the dependencies _to_ the library, so we do not need explicit deps in .pc + echo >>$m 'LDLIBS=' + echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)' + echo >>$c '#define PCI_SHARED_LIB' + if [ "$SHARED" = yes ] ; then +- echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)' ++ echo >>$m 'SONAME=-Wl,-soname -Wl,$(LIBNAME).so$(ABI_VERSION)' + fi + fi + echo >>$m 'PCILIBPC=$(LIBNAME).pc' diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.9/makefile.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.9/makefile.patch new file mode 100644 index 0000000000..811aac8e13 --- /dev/null +++ b/meta/recipes-bsp/pciutils/pciutils-3.1.9/makefile.patch @@ -0,0 +1,14 @@ +Upstream-Status: Inappropriate [configuration] + +diff -ruN pciutils-3.1.7-orig/Makefile pciutils-3.1.7/Makefile +--- pciutils-3.1.7-orig/Makefile 2011-07-11 14:41:59.000000000 +0800 ++++ pciutils-3.1.7/Makefile 2011-07-11 14:42:31.000000000 +0800 +@@ -31,7 +31,7 @@ + IDSDIR=$(SHAREDIR) + MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi) + INCDIR=$(PREFIX)/include +-LIBDIR=$(PREFIX)/lib ++LIBDIR=$(libdir) + PKGCFDIR=$(LIBDIR)/pkgconfig + + # Commands diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.9/pcimodules-pciutils.diff b/meta/recipes-bsp/pciutils/pciutils-3.1.9/pcimodules-pciutils.diff new file mode 100644 index 0000000000..0d4e0fb220 --- /dev/null +++ b/meta/recipes-bsp/pciutils/pciutils-3.1.9/pcimodules-pciutils.diff @@ -0,0 +1,340 @@ +Upstream-Status: Inappropriate [packaging] + +7/30/2010 - rebased to 3.1.5 by Qing He + +diff -uNr pciutils-3.1.5.orig/Makefile pciutils-3.1.5/Makefile +--- pciutils-3.1.5.orig/Makefile 2010-07-30 14:02:15.000000000 +0800 ++++ pciutils-3.1.5/Makefile 2010-07-30 14:02:55.000000000 +0800 +@@ -51,7 +51,7 @@ + + export + +-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) ++all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8 + + lib/$(PCILIB): $(PCIINC) force + $(MAKE) -C lib all +@@ -61,9 +61,11 @@ + lib/config.h lib/config.mk: + cd lib && ./configure + ++pcimodules: pcimodules.o common.o lib/$(PCILIB) + lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB) + setpci: setpci.o common.o lib/$(PCILIB) + ++pcimodules.o: pcimodules.c pciutils.h + LSPCIINC=lspci.h pciutils.h $(PCIINC) + lspci.o: lspci.c $(LSPCIINC) + ls-vpd.o: ls-vpd.c $(LSPCIINC) +@@ -100,10 +102,10 @@ + install: all + # -c is ignored on Linux, but required on FreeBSD + $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7 +- $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR) ++ $(INSTALL) -c -m 755 lspci setpci pcimodules $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR) +- $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8 ++ $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 pcimodules.8 $(DESTDIR)$(MANDIR)/man8 + $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7 + ifeq ($(SHARED),yes) + $(DIRINSTALL) -m 755 $(DESTDIR)$(LIBDIR) +@@ -121,9 +123,9 @@ + endif + + uninstall: all +- rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids ++ rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/pcimodules $(DESTDIR)$(SBINDIR)/update-pciids + rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS) +- rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8 ++ rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/pcimodules.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8 + rm -f $(DESTDIR)$(MANDIR)/man7/pcilib.7 + ifeq ($(SHARED),yes) + rm -f $(DESTDIR)$(LIBDIR)/$(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION) +Index: pciutils-3.0.3/pcimodules.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ pciutils-3.0.3/pcimodules.c 2008-12-31 00:41:47.000000000 +0000 +@@ -0,0 +1,185 @@ ++/* ++ * pcimodules: Load all kernel modules for PCI device currently ++ * plugged into any PCI slot. ++ * ++ * Copyright 2000 Yggdrasil Computing, Incorporated ++ * This file may be copied under the terms and conditions of version ++ * two of the GNU General Public License, as published by the Free ++ * Software Foundation (Cambridge, Massachusetts, USA). ++ * ++ * This file is based on pciutils/lib/example.c, which has the following ++ * authorship and copyright statement: ++ * ++ * Written by Martin Mares and put to public domain. You can do ++ * with it anything you want, but I don't give you any warranty. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define _GNU_SOURCE ++#include ++ ++#include "pciutils.h" ++ ++#define MODDIR "/lib/modules" ++#define PCIMAP "modules.pcimap" ++ ++#define LINELENGTH 8000 ++ ++#define DEVICE_ANY 0xffffffff ++#define VENDOR_ANY 0xffffffff ++ ++#include "lib/pci.h" ++ ++ const char program_name[] = "lspci"; ++ ++struct pcimap_entry { ++ unsigned int vendor, subsys_vendor, dev, subsys_dev, class, class_mask; ++ char *module; ++ struct pcimap_entry *next; ++}; ++ ++static struct pcimap_entry *pcimap_list = NULL; ++ ++#define OPT_STRING "h" ++static struct option long_options[] = { ++ {"class", required_argument, NULL, 'c'}, ++ {"classmask", required_argument, NULL, 'm'}, ++ {"help", no_argument, NULL, 'h'}, ++ { 0, 0, 0, 0} ++}; ++ ++static unsigned long desired_class; ++static unsigned long desired_classmask; /* Default is 0: accept all classes.*/ ++ ++void ++read_pcimap(void) ++{ ++ struct utsname utsname; ++ char filename[MAXPATHLEN]; ++ FILE *pcimap_file; ++ char line[LINELENGTH]; ++ struct pcimap_entry *entry; ++ unsigned int driver_data; ++ char *prevmodule = ""; ++ char module[LINELENGTH]; ++ ++ if (uname(&utsname) < 0) { ++ perror("uname"); ++ exit(1); ++ } ++ sprintf(filename, "%s/%s/%s", MODDIR, utsname.release, PCIMAP); ++ if ((pcimap_file = fopen(filename, "r")) == NULL) { ++ perror(filename); ++ exit(1); ++ } ++ ++ while(fgets(line, LINELENGTH, pcimap_file) != NULL) { ++ if (line[0] == '#') ++ continue; ++ ++ entry = xmalloc(sizeof(struct pcimap_entry)); ++ ++ if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", ++ module, ++ &entry->vendor, &entry->dev, ++ &entry->subsys_vendor, &entry->subsys_dev, ++ &entry->class, &entry->class_mask, ++ &driver_data) != 8) { ++ fprintf (stderr, ++ "modules.pcimap unparsable line: %s.\n", line); ++ free(entry); ++ continue; ++ } ++ ++ /* Optimize memory allocation a bit, in case someday we ++ have Linux systems with ~100,000 modules. It also ++ allows us to just compare pointers to avoid trying ++ to load a module twice. */ ++ if (strcmp(module, prevmodule) != 0) { ++ prevmodule = xmalloc(strlen(module)+1); ++ strcpy(prevmodule, module); ++ } ++ entry->module = prevmodule; ++ entry->next = pcimap_list; ++ pcimap_list = entry; ++ } ++ fclose(pcimap_file); ++} ++ ++/* Return a filled in pci_access->dev tree, with the device classes ++ stored in dev->aux. ++*/ ++static void ++match_pci_modules(void) ++{ ++ struct pci_access *pacc; ++ struct pci_dev *dev; ++ unsigned int class, subsys_dev, subsys_vendor; ++ struct pcimap_entry *map; ++ const char *prevmodule = ""; ++ ++ pacc = pci_alloc(); /* Get the pci_access structure */ ++ /* Set all options you want -- here we stick with the defaults */ ++ pci_init(pacc); /* Initialize the PCI library */ ++ pci_scan_bus(pacc); /* We want to get the list of devices */ ++ for(dev=pacc->devices; dev; dev=dev->next) { ++ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); ++ class = (pci_read_word(dev, PCI_CLASS_DEVICE) << 8) ++ | pci_read_byte(dev, PCI_CLASS_PROG); ++ subsys_dev = pci_read_word(dev, PCI_SUBSYSTEM_ID); ++ subsys_vendor = pci_read_word(dev,PCI_SUBSYSTEM_VENDOR_ID); ++ for(map = pcimap_list; map != NULL; map = map->next) { ++ if (((map->class ^ class) & map->class_mask) == 0 && ++ ((desired_class ^ class) & desired_classmask)==0 && ++ (map->dev == DEVICE_ANY || ++ map->dev == dev->device_id) && ++ (map->vendor == VENDOR_ANY || ++ map->vendor == dev->vendor_id) && ++ (map->subsys_dev == DEVICE_ANY || ++ map->subsys_dev == subsys_dev) && ++ (map->subsys_vendor == VENDOR_ANY || ++ map->subsys_vendor == subsys_vendor) && ++ prevmodule != map->module) { ++ printf("%s\n", map->module); ++ prevmodule = map->module; ++ } ++ } ++ ++ } ++ pci_cleanup(pacc); ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int opt_index = 0; ++ int opt; ++ ++ while ((opt = getopt_long(argc, argv, OPT_STRING, long_options, ++ &opt_index)) != -1) { ++ switch(opt) { ++ case 'c': ++ desired_class = strtol(optarg, NULL, 0); ++ break; ++ case 'm': ++ desired_classmask = strtol(optarg, NULL, 0); ++ break; ++ case 'h': ++ printf ("Usage: pcimodules [--help]\n" ++ " Lists kernel modules corresponding to PCI devices currently plugged" ++ " into the computer.\n"); ++ } ++ } ++ ++ read_pcimap(); ++ match_pci_modules(); ++ return 0; ++} +Index: pciutils-3.0.3/pcimodules.man +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ pciutils-3.0.3/pcimodules.man 2008-12-31 00:41:47.000000000 +0000 +@@ -0,0 +1,92 @@ ++.TH pcimodules 8 "@TODAY@" "@VERSION@" "Linux PCI Utilities" ++.IX pcimodules ++.SH NAME ++pcimodules \- List kernel driver modules available for all currently plugged ++in PCI devices ++.SH SYNOPSIS ++.B pcimodules ++.RB [ --class class_id ] ++.RB [ --classmask mask ] ++.RB [ --help ] ++.SH DESCRIPTION ++.B pcimodules ++lists all driver modules for all currently plugged in PCI devices. ++.B pcimodules ++should be run at boot time, and whenever a PCI device is "hot plugged" ++into the system. This can be done by the following Bourne shell syntax: ++.IP ++ for module in $(pcimodules) ; do ++.IP ++ modprobe -s -k "$module" ++.IP ++ done ++.PP ++When a PCI device is removed from the system, the Linux kernel will ++decrement a usage count on PCI driver module. If this count drops ++to zero (i.e., there are no PCI drivers), then the ++.B modprobe -r ++process that is normally configured to run from cron every few minutes ++will eventually remove the unneeded module. ++.PP ++The --class and --classmask arguments can be used to limit the search ++to certain classes of PCI devices. This is useful, for example, to ++generate a list of ethernet card drivers to be loaded when the kernel ++has indicated that it is trying to resolve an unknown network interface. ++.PP ++Modules are listed in the order in which the PCI devices are physically ++arranged so that the computer owner can arrange things like having scsi ++device 0 be on a controller that is not alphabetically the first scsi ++controller. ++.SH OPTIONS ++.TP ++.B --class class --classmask mask ++.PP ++--class and --classmask limit the search to PCI ++cards in particular classes. These arguments are always used together. ++The arguments to --class and --classmask ++can be given as hexadecimal numbers by prefixing a leading "0x". ++Note that the classes used by pcimodules are in "Linux" format, ++meaning the class value that you see with lspci would be shifted ++left eight bits, with the new low eight bits programming interface ID. ++An examples of how to use class and classmask is provided below. ++.B --help, -h ++Print a help message and exit. ++.SH EXAMPLES ++.TP ++pcimodules ++lists all modules corresponding to currently plugged in PCI devices. ++.TP ++pcimodules --class 0x200000 --classmask 0xffff00 ++lists all modules corresponding to currently plugged in ethernet PCI devices. ++.SH FILES ++.TP ++.B /lib/modules//modules.pcimap ++This file is automatically generated by ++.B depmod, ++and used by ++.B pcimodules ++to determine which modules correspond to which PCI ID's. ++.TP ++.B /proc/bus/pci ++An interface to PCI bus configuration space provided by the post-2.1.82 Linux ++kernels. Contains per-bus subdirectories with per-card config space files and a ++.I devices ++file containing a list of all PCI devices. ++ ++.SH SEE ALSO ++.BR lspci (8) ++ ++.SH MAINTAINER ++The Linux PCI Utilities are maintained by Martin Mares . ++ ++.SH AUTHOR ++.B pcimodules ++was written by Adam J. Richter , based on public ++domain example code by Martin Mares . ++ ++.SH COPYRIGHT ++.B pcimodules ++is copyright 2000, Yggdrasil Computing, Incorporated, and may ++be copied under the terms and conditions of version 2 of the GNU ++General Public License as published by the Free Software Foundation ++(Cambrige, Massachusetts, United States of America). -- cgit v1.2.3-54-g00ecf