diff options
author | 2005-10-16 03:17:19 +0000 | |
---|---|---|
committer | 2005-10-16 03:17:19 +0000 | |
commit | 6f85810ee3913203bd1828a15bf31bedb73a1a3a (patch) | |
tree | 3709f397d33c53a663ea5b1328ef256c50fbaa21 /sys-apps/pciutils | |
parent | Marked stable on amd64 (diff) | |
download | gentoo-2-6f85810ee3913203bd1828a15bf31bedb73a1a3a.tar.gz gentoo-2-6f85810ee3913203bd1828a15bf31bedb73a1a3a.tar.bz2 gentoo-2-6f85810ee3913203bd1828a15bf31bedb73a1a3a.zip |
Version bump #109352 by Daniel Drake.
(Portage version: 2.0.53_rc5)
Diffstat (limited to 'sys-apps/pciutils')
-rw-r--r-- | sys-apps/pciutils/ChangeLog | 8 | ||||
-rw-r--r-- | sys-apps/pciutils/files/digest-pciutils-2.2.0 | 2 | ||||
-rw-r--r-- | sys-apps/pciutils/files/pcimodules-pciutils-2.2.0.patch | 339 | ||||
-rw-r--r-- | sys-apps/pciutils/pciutils-2.2.0.ebuild | 61 |
4 files changed, 409 insertions, 1 deletions
diff --git a/sys-apps/pciutils/ChangeLog b/sys-apps/pciutils/ChangeLog index 1d26de8aea89..98f362f95109 100644 --- a/sys-apps/pciutils/ChangeLog +++ b/sys-apps/pciutils/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sys-apps/pciutils # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/ChangeLog,v 1.59 2005/09/29 18:09:55 hardave Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/ChangeLog,v 1.60 2005/10/16 03:17:19 vapier Exp $ + +*pciutils-2.2.0 (16 Oct 2005) + + 16 Oct 2005; Mike Frysinger <vapier@gentoo.org> + +files/pcimodules-pciutils-2.2.0.patch, +pciutils-2.2.0.ebuild: + Version bump #109352 by Daniel Drake. 29 Sep 2005; Hardave Riar <hardave@gentoo.org> pciutils-2.1.11-r5.ebuild: Stable on mips. diff --git a/sys-apps/pciutils/files/digest-pciutils-2.2.0 b/sys-apps/pciutils/files/digest-pciutils-2.2.0 new file mode 100644 index 000000000000..f8f1bd12d8e2 --- /dev/null +++ b/sys-apps/pciutils/files/digest-pciutils-2.2.0 @@ -0,0 +1,2 @@ +MD5 4b8d2ee3ad78e4d0343a74a9b0fb84a8 pci.ids-20051015.bz2 98776 +MD5 303fc4bb9669549acf65e4a714527c7e pciutils-2.2.0.tar.gz 194290 diff --git a/sys-apps/pciutils/files/pcimodules-pciutils-2.2.0.patch b/sys-apps/pciutils/files/pcimodules-pciutils-2.2.0.patch new file mode 100644 index 000000000000..584bfde6e14b --- /dev/null +++ b/sys-apps/pciutils/files/pcimodules-pciutils-2.2.0.patch @@ -0,0 +1,339 @@ +--- pciutils-2.2.0/lspci.c ++++ pciutils-dsd/lspci.c +@@ -113,8 +113,10 @@ scan_device(struct pci_dev *p) + d->config = xmalloc(64); + d->present = xmalloc(64); + memset(d->present, 1, 64); +- if (!pci_read_block(p, 0, d->config, 64)) +- die("Unable to read the standard configuration space header"); ++ if (!pci_read_block(p, 0, d->config, 64)) { ++ fprintf(stderr, "Unable to read the standard configuration space header"); ++ return NULL; ++ } + if ((d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS) + { + /* For cardbus bridges, we need to fetch 64 bytes more to get the +--- pciutils-2.2.0/Makefile ++++ pciutils-dsd/Makefile +@@ -33,7 +33,7 @@ RELEASE= + + export + +-all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids ++all: $(PCILIB) lspci setpci pcimodules lspci.8 setpci.8 update-pciids update-pciids.8 pcimodules.8 pci.ids + + $(PCILIB): $(PCIINC) force + $(MAKE) -C lib all +@@ -43,9 +43,11 @@ force: + lib/config.h: + cd lib && ./configure $(IDSDIR) $(VERSION) $(HOST) $(RELEASE) + ++pcimodules: pcimodules.o common.o $(PCILIB) + lspci: lspci.o common.o $(PCILIB) + setpci: setpci.o common.o $(PCILIB) + ++pcimodules.o: pcimodules.c pciutils.h $(PCIINC) + lspci.o: lspci.c pciutils.h $(PCIINC) + setpci.o: setpci.c pciutils.h $(PCIINC) + common.o: common.c pciutils.h $(PCIINC) +@@ -66,15 +68,15 @@ distclean: clean + install: all + # -c is ignored on Linux, but required on FreeBSD + $(DIRINSTALL) -m 755 $(SBINDIR) $(IDSDIR) $(MANDIR)/man8 +- $(INSTALL) -c -m 755 -s lspci setpci $(SBINDIR) ++ $(INSTALL) -c -m 755 -s lspci setpci pcimodules $(SBINDIR) + $(INSTALL) -c -m 755 update-pciids $(SBINDIR) + $(INSTALL) -c -m 644 pci.ids $(IDSDIR) +- $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(MANDIR)/man8 ++ $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 pcimodules.8 $(MANDIR)/man8 + + uninstall: all +- rm -f $(SBINDIR)/lspci $(SBINDIR)/setpci $(SBINDIR)/update-pciids ++ rm -f $(SBINDIR)/lspci $(SBINDIR)/setpci $(SBINDIR)/update-pciids $(SBINDIR)/pcimodules + rm -f $(IDSDIR)/pci.ids +- rm -f $(MANDIR)/man8/lspci.8 $(MANDIR)/man8/setpci.8 $(MANDIR)/man8/update-pciids.8 ++ rm -f $(MANDIR)/man8/lspci.8 $(MANDIR)/man8/setpci.8 $(MANDIR)/man8/update-pciids.8 $(MANDIR)/man8/pcimodules.8 + + get-ids: + cp ~/tree/pciids/pci.ids pci.ids +--- pciutils-2.2.0/pcimodules.c ++++ pciutils-dsd/pcimodules.c +@@ -0,0 +1,183 @@ ++/* ++ * 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 <stdlib.h> ++#include <stdio.h> ++#include <malloc.h> ++#include <string.h> ++#include <unistd.h> ++#include <sys/utsname.h> ++#include <sys/param.h> ++#include <sys/types.h> ++ ++#define _GNU_SOURCE ++#include <getopt.h> ++ ++#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" ++ ++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; ++} +--- pciutils-2.2.0/pcimodules.man ++++ pciutils-dsd/pcimodules.man +@@ -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/<kernel-version>/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 <mj@suse.cz>. ++ ++.SH AUTHOR ++.B pcimodules ++was written by Adam J. Richter <adam@yggdrasil.com>, based on public ++domain example code by Martin Mares <mj@suse.cz>. ++ ++.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). diff --git a/sys-apps/pciutils/pciutils-2.2.0.ebuild b/sys-apps/pciutils/pciutils-2.2.0.ebuild new file mode 100644 index 000000000000..8d69b5a5ddf2 --- /dev/null +++ b/sys-apps/pciutils/pciutils-2.2.0.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/pciutils/pciutils-2.2.0.ebuild,v 1.1 2005/10/16 03:17:19 vapier Exp $ + +inherit eutils flag-o-matic toolchain-funcs + +STAMP=20051015 +DESCRIPTION="Various utilities dealing with the PCI bus" +HOMEPAGE="http://atrey.karlin.mff.cuni.cz/~mj/pciutils.html" +SRC_URI="ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/${P}.tar.gz + mirror://gentoo/pci.ids-${STAMP}.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="" + +DEPEND="" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/pcimodules-${P}.patch + + # Set Gentoo paths + sed -i \ + -e '/^PREFIX=/s:=.*:=/usr:' \ + -e '/^IDSDIR=/s:=.*:=$(PREFIX)/share/misc:' \ + Makefile || die + + # Make sure we respect $AR / $RANLIB + sed -i \ + -e '/ar rcs/s:ar:$(AR):' \ + -e 's:ranlib:$(RANLIB):' \ + lib/Makefile \ + || die "sed lib/Makefile failed" + + ebegin "Updating pci.ids from the web" + if ! ./update-pciids.sh &> /dev/null ; then + # if we cant update, use a cached version + mv ${WORKDIR}/pci.ids-${STAMP} ${S}/pci.ids + fi + eend 0 +} + +src_compile() { + tc-export AR CC RANLIB + emake OPT="${CFLAGS}" || die "emake failed" +} + +src_install() { + dodir /usr/share/man + make install PREFIX="${D}"/usr || die + +#Wonder if this stuff is even used ... one way to find out though ;) +# into /usr +# dolib lib/libpci.a || die "libpci failed" +# insinto /usr/include/pci +# doins lib/*.h || die "headers failed" +} |