summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/pciutils/pciutils-3.1.5
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-bsp/pciutils/pciutils-3.1.5')
-rw-r--r--meta/recipes-bsp/pciutils/pciutils-3.1.5/configure.patch102
-rw-r--r--meta/recipes-bsp/pciutils/pciutils-3.1.5/guess-fix.patch35
-rw-r--r--meta/recipes-bsp/pciutils/pciutils-3.1.5/lib-build-fix.patch92
-rw-r--r--meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff338
4 files changed, 567 insertions, 0 deletions
diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.5/configure.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.5/configure.patch
new file mode 100644
index 0000000000..1bfe724750
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils-3.1.5/configure.patch
@@ -0,0 +1,102 @@
1
2#
3# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4#
5---
6
77/30/2010 - rebased to 3.1.5 by Qing He <qing.he@intel.com>
8
9diff -uNr pciutils-3.1.5.orig/lib/configure pciutils-3.1.5/lib/configure
10--- pciutils-3.1.5.orig/lib/configure 2010-07-30 13:51:58.000000000 +0800
11+++ pciutils-3.1.5/lib/configure 2010-07-30 13:53:25.000000000 +0800
12@@ -14,6 +14,10 @@
13 fi
14 }
15
16+VERSION=$1
17+IDSDIR=$2
18+DNS=yes
19+
20 if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
21 echo >&2 "Please run the configure script from the top-level Makefile"
22 exit 1
23@@ -21,8 +25,8 @@
24
25 echo_n "Configuring libpci for your system..."
26 if [ -z "$HOST" ] ; then
27- sys=`uname -s`
28- rel=`uname -r`
29+ sys=${3:-`uname -s`}
30+ rel=
31 realsys="$sys"
32 if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
33 then
34@@ -30,7 +34,7 @@
35 proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
36 cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
37 else
38- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'`
39+ cpu=${4:-`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'`}
40 fi
41 if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
42 then
43@@ -40,7 +44,7 @@
44 then
45 sys=cygwin
46 fi
47- HOST=${3:-$cpu-$sys}
48+ HOST=$cpu-$sys
49 fi
50 [ -n "$RELEASE" ] && rel="${RELEASE}"
51 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
52@@ -49,6 +53,21 @@
53 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
54 echo " $host $rel $cpu $sys"
55
56+if [ "$host" = "linux--gnueabi" ]
57+then
58+ sys=linux
59+fi
60+
61+if [ "$host" = "linux--uclibc" ]
62+then
63+ sys=linux
64+fi
65+
66+if [ "$host" = "linux--uclibcgnueabi" ]
67+then
68+ sys=linux
69+fi
70+
71 c=config.h
72 m=config.mk
73 echo >$c '#define PCI_CONFIG_H'
74diff -uNr pciutils-3.1.5.orig/Makefile pciutils-3.1.5/Makefile
75--- pciutils-3.1.5.orig/Makefile 2010-07-30 13:51:58.000000000 +0800
76+++ pciutils-3.1.5/Makefile 2010-07-30 13:52:24.000000000 +0800
77@@ -37,7 +37,6 @@
78 # Commands
79 INSTALL=install
80 DIRINSTALL=install -d
81-STRIP=-s
82 CC=$(CROSS_COMPILE)gcc
83 AR=$(CROSS_COMPILE)ar
84 RANLIB=$(CROSS_COMPILE)ranlib
85@@ -86,7 +85,7 @@
86 example.o: example.c $(PCIINC)
87
88 %: %.o
89- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
90+ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@
91
92 %.8 %.7: %.man
93 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)#"
94@@ -101,7 +100,7 @@
95 install: all
96 # -c is ignored on Linux, but required on FreeBSD
97 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
98- $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
99+ $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR)
100 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
101 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
102 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.5/guess-fix.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.5/guess-fix.patch
new file mode 100644
index 0000000000..9072d2a68f
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils-3.1.5/guess-fix.patch
@@ -0,0 +1,35 @@
1the original guess algorithm is broken for many archs
2for example, the following two would break:
3 arm-linux-gnueabi --> sys=gnueabi
4 x86_64-unknown-pc-linux-gnu --> sys = pc-linux-gnu
5
6use a simpler scheme here and hope it works for all the cases
7
87/30/2010 - created by Qing He <qing.he@intel.com>
9
10diff --git a/lib/configure b/lib/configure
11index 4318b05..84f6acb 100755
12--- a/lib/configure
13+++ b/lib/configure
14@@ -53,20 +53,7 @@ cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
15 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
16 echo " $host $rel $cpu $sys"
17
18-if [ "$host" = "linux--gnueabi" ]
19-then
20- sys=linux
21-fi
22-
23-if [ "$host" = "linux--uclibc" ]
24-then
25- sys=linux
26-fi
27-
28-if [ "$host" = "linux--uclibcgnueabi" ]
29-then
30- sys=linux
31-fi
32+{ echo "$host" | grep linux; } && sys=linux
33
34 c=config.h
35 m=config.mk
diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.5/lib-build-fix.patch b/meta/recipes-bsp/pciutils/pciutils-3.1.5/lib-build-fix.patch
new file mode 100644
index 0000000000..1e81f8401b
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils-3.1.5/lib-build-fix.patch
@@ -0,0 +1,92 @@
1Link directly to lib/libpci.so.3.1.5 will hard code this versioned
2string into lspci and other utilities, which is not desirable and
3won't work. In the other hand, linking to a symbolic link lib/libpci.so
4doesn't have this issue.
5
67/30/2010 - created by Qing He <qing.he@intel.com>
7
8diff --git a/Makefile b/Makefile
9index 1b48e18..21af4b3 100644
10--- a/Makefile
11+++ b/Makefile
12@@ -51,9 +51,9 @@ PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
13
14 export
15
16-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8
17+all: lib/$(PCILIB_DEV) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8
18
19-lib/$(PCILIB): $(PCIINC) force
20+lib/$(PCILIB) lib/$(PCILIB_DEV): $(PCIINC) force
21 $(MAKE) -C lib all
22
23 force:
24@@ -61,9 +61,9 @@ force:
25 lib/config.h lib/config.mk:
26 cd lib && ./configure
27
28-pcimodules: pcimodules.o common.o lib/$(PCILIB)
29-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)
30-setpci: setpci.o common.o lib/$(PCILIB)
31+pcimodules: pcimodules.o common.o lib/$(PCILIB_DEV)
32+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)
33+setpci: setpci.o common.o lib/$(PCILIB_DEV)
34
35 pcimodules.o: pcimodules.c pciutils.h
36 LSPCIINC=lspci.h pciutils.h $(PCIINC)
37@@ -83,7 +83,7 @@ update-pciids: update-pciids.sh
38 chmod +x $@
39
40 # The example of use of libpci
41-example: example.o lib/$(PCILIB)
42+example: example.o lib/$(PCILIB_DEV)
43 example.o: example.c $(PCIINC)
44
45 %: %.o
46diff --git a/lib/Makefile b/lib/Makefile
47index 1eb06a5..a8dab56 100644
48--- a/lib/Makefile
49+++ b/lib/Makefile
50@@ -42,7 +42,7 @@ ifdef PCI_HAVE_PM_NBSD_LIBPCI
51 OBJS += nbsd-libpci
52 endif
53
54-all: $(PCILIB) $(PCILIBPC)
55+all: $(PCILIB_DEV) $(PCILIBPC)
56
57 ifeq ($(SHARED),no)
58 $(PCILIB): $(addsuffix .o,$(OBJS))
59@@ -53,6 +53,9 @@ else
60 CFLAGS += -fPIC -fvisibility=hidden
61 $(PCILIB): $(addsuffix .o,$(OBJS))
62 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS)
63+
64+$(PCILIB_DEV): $(PCILIB)
65+ ln -s $< $@
66 endif
67
68 $(PCILIBPC): libpci.pc.in
69diff --git a/lib/configure b/lib/configure
70index eec225a..4318b05 100755
71--- a/lib/configure
72+++ b/lib/configure
73@@ -174,16 +193,18 @@ fi
74 echo "Checking whether to build a shared library... $SHARED (set manually)"
75 if [ "$SHARED" = no ] ; then
76 echo >>$m 'PCILIB=$(LIBNAME).a'
77+ echo >>$m 'PCILIB_DEV=$(LIBNAME).a'
78 echo >>$m 'LDLIBS=$(WITH_LIBS)'
79 echo >>$m 'LIB_LDLIBS='
80 else
81 echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
82+ echo >>$m 'PCILIB_DEV=$(LIBNAME).so'
83 # We link the dependencies _to_ the library, so we do not need explicit deps in .pc
84 echo >>$m 'LDLIBS='
85 echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
86 echo >>$c '#define PCI_SHARED_LIB'
87 if [ "$SHARED" = yes ] ; then
88- echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
89+ echo >>$m 'SONAME=-Wl,-soname -Wl,$(LIBNAME).so$(ABI_VERSION)'
90 fi
91 fi
92 echo >>$m 'PCILIBPC=$(LIBNAME).pc'
diff --git a/meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff b/meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff
new file mode 100644
index 0000000000..36ea3b76be
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff
@@ -0,0 +1,338 @@
17/30/2010 - rebased to 3.1.5 by Qing He <qing.he@intel.com>
2
3diff -uNr pciutils-3.1.5.orig/Makefile pciutils-3.1.5/Makefile
4--- pciutils-3.1.5.orig/Makefile 2010-07-30 14:02:15.000000000 +0800
5+++ pciutils-3.1.5/Makefile 2010-07-30 14:02:55.000000000 +0800
6@@ -51,7 +51,7 @@
7
8 export
9
10-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
11+all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) pcimodules pcimodules.8
12
13 lib/$(PCILIB): $(PCIINC) force
14 $(MAKE) -C lib all
15@@ -61,9 +61,11 @@
16 lib/config.h lib/config.mk:
17 cd lib && ./configure
18
19+pcimodules: pcimodules.o common.o lib/$(PCILIB)
20 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)
21 setpci: setpci.o common.o lib/$(PCILIB)
22
23+pcimodules.o: pcimodules.c pciutils.h
24 LSPCIINC=lspci.h pciutils.h $(PCIINC)
25 lspci.o: lspci.c $(LSPCIINC)
26 ls-vpd.o: ls-vpd.c $(LSPCIINC)
27@@ -100,10 +102,10 @@
28 install: all
29 # -c is ignored on Linux, but required on FreeBSD
30 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
31- $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR)
32+ $(INSTALL) -c -m 755 lspci setpci pcimodules $(DESTDIR)$(SBINDIR)
33 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
34 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
35- $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
36+ $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 pcimodules.8 $(DESTDIR)$(MANDIR)/man8
37 $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7
38 ifeq ($(SHARED),yes)
39 $(DIRINSTALL) -m 755 $(DESTDIR)$(LIBDIR)
40@@ -121,9 +123,9 @@
41 endif
42
43 uninstall: all
44- rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
45+ rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/pcimodules $(DESTDIR)$(SBINDIR)/update-pciids
46 rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS)
47- rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
48+ rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/pcimodules.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
49 rm -f $(DESTDIR)$(MANDIR)/man7/pcilib.7
50 ifeq ($(SHARED),yes)
51 rm -f $(DESTDIR)$(LIBDIR)/$(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
52Index: pciutils-3.0.3/pcimodules.c
53===================================================================
54--- /dev/null 1970-01-01 00:00:00.000000000 +0000
55+++ pciutils-3.0.3/pcimodules.c 2008-12-31 00:41:47.000000000 +0000
56@@ -0,0 +1,185 @@
57+/*
58+ * pcimodules: Load all kernel modules for PCI device currently
59+ * plugged into any PCI slot.
60+ *
61+ * Copyright 2000 Yggdrasil Computing, Incorporated
62+ * This file may be copied under the terms and conditions of version
63+ * two of the GNU General Public License, as published by the Free
64+ * Software Foundation (Cambridge, Massachusetts, USA).
65+ *
66+ * This file is based on pciutils/lib/example.c, which has the following
67+ * authorship and copyright statement:
68+ *
69+ * Written by Martin Mares and put to public domain. You can do
70+ * with it anything you want, but I don't give you any warranty.
71+ */
72+
73+#include <stdlib.h>
74+#include <stdio.h>
75+#include <malloc.h>
76+#include <string.h>
77+#include <unistd.h>
78+#include <sys/utsname.h>
79+#include <sys/param.h>
80+#include <sys/types.h>
81+
82+#define _GNU_SOURCE
83+#include <getopt.h>
84+
85+#include "pciutils.h"
86+
87+#define MODDIR "/lib/modules"
88+#define PCIMAP "modules.pcimap"
89+
90+#define LINELENGTH 8000
91+
92+#define DEVICE_ANY 0xffffffff
93+#define VENDOR_ANY 0xffffffff
94+
95+#include "lib/pci.h"
96+
97+ const char program_name[] = "lspci";
98+
99+struct pcimap_entry {
100+ unsigned int vendor, subsys_vendor, dev, subsys_dev, class, class_mask;
101+ char *module;
102+ struct pcimap_entry *next;
103+};
104+
105+static struct pcimap_entry *pcimap_list = NULL;
106+
107+#define OPT_STRING "h"
108+static struct option long_options[] = {
109+ {"class", required_argument, NULL, 'c'},
110+ {"classmask", required_argument, NULL, 'm'},
111+ {"help", no_argument, NULL, 'h'},
112+ { 0, 0, 0, 0}
113+};
114+
115+static unsigned long desired_class;
116+static unsigned long desired_classmask; /* Default is 0: accept all classes.*/
117+
118+void
119+read_pcimap(void)
120+{
121+ struct utsname utsname;
122+ char filename[MAXPATHLEN];
123+ FILE *pcimap_file;
124+ char line[LINELENGTH];
125+ struct pcimap_entry *entry;
126+ unsigned int driver_data;
127+ char *prevmodule = "";
128+ char module[LINELENGTH];
129+
130+ if (uname(&utsname) < 0) {
131+ perror("uname");
132+ exit(1);
133+ }
134+ sprintf(filename, "%s/%s/%s", MODDIR, utsname.release, PCIMAP);
135+ if ((pcimap_file = fopen(filename, "r")) == NULL) {
136+ perror(filename);
137+ exit(1);
138+ }
139+
140+ while(fgets(line, LINELENGTH, pcimap_file) != NULL) {
141+ if (line[0] == '#')
142+ continue;
143+
144+ entry = xmalloc(sizeof(struct pcimap_entry));
145+
146+ if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
147+ module,
148+ &entry->vendor, &entry->dev,
149+ &entry->subsys_vendor, &entry->subsys_dev,
150+ &entry->class, &entry->class_mask,
151+ &driver_data) != 8) {
152+ fprintf (stderr,
153+ "modules.pcimap unparsable line: %s.\n", line);
154+ free(entry);
155+ continue;
156+ }
157+
158+ /* Optimize memory allocation a bit, in case someday we
159+ have Linux systems with ~100,000 modules. It also
160+ allows us to just compare pointers to avoid trying
161+ to load a module twice. */
162+ if (strcmp(module, prevmodule) != 0) {
163+ prevmodule = xmalloc(strlen(module)+1);
164+ strcpy(prevmodule, module);
165+ }
166+ entry->module = prevmodule;
167+ entry->next = pcimap_list;
168+ pcimap_list = entry;
169+ }
170+ fclose(pcimap_file);
171+}
172+
173+/* Return a filled in pci_access->dev tree, with the device classes
174+ stored in dev->aux.
175+*/
176+static void
177+match_pci_modules(void)
178+{
179+ struct pci_access *pacc;
180+ struct pci_dev *dev;
181+ unsigned int class, subsys_dev, subsys_vendor;
182+ struct pcimap_entry *map;
183+ const char *prevmodule = "";
184+
185+ pacc = pci_alloc(); /* Get the pci_access structure */
186+ /* Set all options you want -- here we stick with the defaults */
187+ pci_init(pacc); /* Initialize the PCI library */
188+ pci_scan_bus(pacc); /* We want to get the list of devices */
189+ for(dev=pacc->devices; dev; dev=dev->next) {
190+ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);
191+ class = (pci_read_word(dev, PCI_CLASS_DEVICE) << 8)
192+ | pci_read_byte(dev, PCI_CLASS_PROG);
193+ subsys_dev = pci_read_word(dev, PCI_SUBSYSTEM_ID);
194+ subsys_vendor = pci_read_word(dev,PCI_SUBSYSTEM_VENDOR_ID);
195+ for(map = pcimap_list; map != NULL; map = map->next) {
196+ if (((map->class ^ class) & map->class_mask) == 0 &&
197+ ((desired_class ^ class) & desired_classmask)==0 &&
198+ (map->dev == DEVICE_ANY ||
199+ map->dev == dev->device_id) &&
200+ (map->vendor == VENDOR_ANY ||
201+ map->vendor == dev->vendor_id) &&
202+ (map->subsys_dev == DEVICE_ANY ||
203+ map->subsys_dev == subsys_dev) &&
204+ (map->subsys_vendor == VENDOR_ANY ||
205+ map->subsys_vendor == subsys_vendor) &&
206+ prevmodule != map->module) {
207+ printf("%s\n", map->module);
208+ prevmodule = map->module;
209+ }
210+ }
211+
212+ }
213+ pci_cleanup(pacc);
214+}
215+
216+int
217+main (int argc, char **argv)
218+{
219+ int opt_index = 0;
220+ int opt;
221+
222+ while ((opt = getopt_long(argc, argv, OPT_STRING, long_options,
223+ &opt_index)) != -1) {
224+ switch(opt) {
225+ case 'c':
226+ desired_class = strtol(optarg, NULL, 0);
227+ break;
228+ case 'm':
229+ desired_classmask = strtol(optarg, NULL, 0);
230+ break;
231+ case 'h':
232+ printf ("Usage: pcimodules [--help]\n"
233+ " Lists kernel modules corresponding to PCI devices currently plugged"
234+ " into the computer.\n");
235+ }
236+ }
237+
238+ read_pcimap();
239+ match_pci_modules();
240+ return 0;
241+}
242Index: pciutils-3.0.3/pcimodules.man
243===================================================================
244--- /dev/null 1970-01-01 00:00:00.000000000 +0000
245+++ pciutils-3.0.3/pcimodules.man 2008-12-31 00:41:47.000000000 +0000
246@@ -0,0 +1,92 @@
247+.TH pcimodules 8 "@TODAY@" "@VERSION@" "Linux PCI Utilities"
248+.IX pcimodules
249+.SH NAME
250+pcimodules \- List kernel driver modules available for all currently plugged
251+in PCI devices
252+.SH SYNOPSIS
253+.B pcimodules
254+.RB [ --class class_id ]
255+.RB [ --classmask mask ]
256+.RB [ --help ]
257+.SH DESCRIPTION
258+.B pcimodules
259+lists all driver modules for all currently plugged in PCI devices.
260+.B pcimodules
261+should be run at boot time, and whenever a PCI device is "hot plugged"
262+into the system. This can be done by the following Bourne shell syntax:
263+.IP
264+ for module in $(pcimodules) ; do
265+.IP
266+ modprobe -s -k "$module"
267+.IP
268+ done
269+.PP
270+When a PCI device is removed from the system, the Linux kernel will
271+decrement a usage count on PCI driver module. If this count drops
272+to zero (i.e., there are no PCI drivers), then the
273+.B modprobe -r
274+process that is normally configured to run from cron every few minutes
275+will eventually remove the unneeded module.
276+.PP
277+The --class and --classmask arguments can be used to limit the search
278+to certain classes of PCI devices. This is useful, for example, to
279+generate a list of ethernet card drivers to be loaded when the kernel
280+has indicated that it is trying to resolve an unknown network interface.
281+.PP
282+Modules are listed in the order in which the PCI devices are physically
283+arranged so that the computer owner can arrange things like having scsi
284+device 0 be on a controller that is not alphabetically the first scsi
285+controller.
286+.SH OPTIONS
287+.TP
288+.B --class class --classmask mask
289+.PP
290+--class and --classmask limit the search to PCI
291+cards in particular classes. These arguments are always used together.
292+The arguments to --class and --classmask
293+can be given as hexadecimal numbers by prefixing a leading "0x".
294+Note that the classes used by pcimodules are in "Linux" format,
295+meaning the class value that you see with lspci would be shifted
296+left eight bits, with the new low eight bits programming interface ID.
297+An examples of how to use class and classmask is provided below.
298+.B --help, -h
299+Print a help message and exit.
300+.SH EXAMPLES
301+.TP
302+pcimodules
303+lists all modules corresponding to currently plugged in PCI devices.
304+.TP
305+pcimodules --class 0x200000 --classmask 0xffff00
306+lists all modules corresponding to currently plugged in ethernet PCI devices.
307+.SH FILES
308+.TP
309+.B /lib/modules/<kernel-version>/modules.pcimap
310+This file is automatically generated by
311+.B depmod,
312+and used by
313+.B pcimodules
314+to determine which modules correspond to which PCI ID's.
315+.TP
316+.B /proc/bus/pci
317+An interface to PCI bus configuration space provided by the post-2.1.82 Linux
318+kernels. Contains per-bus subdirectories with per-card config space files and a
319+.I devices
320+file containing a list of all PCI devices.
321+
322+.SH SEE ALSO
323+.BR lspci (8)
324+
325+.SH MAINTAINER
326+The Linux PCI Utilities are maintained by Martin Mares <mj@suse.cz>.
327+
328+.SH AUTHOR
329+.B pcimodules
330+was written by Adam J. Richter <adam@yggdrasil.com>, based on public
331+domain example code by Martin Mares <mj@suse.cz>.
332+
333+.SH COPYRIGHT
334+.B pcimodules
335+is copyright 2000, Yggdrasil Computing, Incorporated, and may
336+be copied under the terms and conditions of version 2 of the GNU
337+General Public License as published by the Free Software Foundation
338+(Cambrige, Massachusetts, United States of America).