summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff')
-rw-r--r--meta/recipes-bsp/pciutils/pciutils-3.1.5/pcimodules-pciutils.diff338
1 files changed, 338 insertions, 0 deletions
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).