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