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