automatic update by autodist [release 3.2.1-1mamba;Fri Nov 15 2013]

This commit is contained in:
Automatic Build System 2024-01-06 08:27:04 +01:00
parent ef4c21f7ec
commit 5f38236b99
5 changed files with 542 additions and 0 deletions

View File

@ -1,2 +1,10 @@
# pciutils
The PCI Utilities package contains a library for portable access to PCI bus configuration space and several utilities based on this library.
Current version works only on Linux and FreeBSD, but it can be easily extended to work on other systems as well.
The utilities include: (See manual pages for more details) :
lspci - displays detailed information about all PCI busses and devices in the system, replacing the original /proc/pci interface.
setpci - allows to read from and write to PCI device configuration registers. For example, you can adjust the latency timers with it.
The library (and therefore all the utilities) - can access PCI registers either via the /proc/bus/pci interface present since Linux 2.1.82 or via direct hardware access (to be used with older kernels and also for hardware diagnostics).
It's also capable of reading and interpreting register dumps printed by `lspci -x'.

View File

@ -0,0 +1,12 @@
diff -up pciutils-3.0.0/Makefile.idpath pciutils-3.0.0/Makefile
--- pciutils-3.0.0/Makefile.idpath 2008-04-10 21:19:43.000000000 +0200
+++ pciutils-3.0.0/Makefile 2008-09-01 15:16:19.000000000 +0200
@@ -27,7 +27,7 @@ ABI_VERSION=.3
PREFIX=/usr/local
SBINDIR=$(PREFIX)/sbin
SHAREDIR=$(PREFIX)/share
-IDSDIR=$(SHAREDIR)
+IDSDIR=$(SHAREDIR)/hwdata
MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
INCDIR=$(PREFIX)/include
LIBDIR=$(PREFIX)/lib

View File

@ -0,0 +1,18 @@
--- pciutils-3.1.0/Makefile
+++ pciutils-3.1.0/Makefile
@@ -62,6 +62,7 @@
lib/config.h lib/config.mk:
cd lib && ./configure
+pcimodules: pcimodules.o common.o lib/$(PCILIB)
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)
setpci: setpci.o common.o lib/$(PCILIB)
@@ -74,6 +75,7 @@
ls-tree.o: ls-tree.c $(LSPCIINC)
ls-map.o: ls-map.c $(LSPCIINC)
+pcimodules.o: pcimodules.c pciutils.h $(PCIINC)
setpci.o: setpci.c pciutils.h $(PCIINC)
common.o: common.c pciutils.h $(PCIINC)

View File

@ -0,0 +1,284 @@
diff -Naur pciutils-3.0.3.orig/pcimodules.c pciutils-3.0.3/pcimodules.c
--- pciutils-3.0.3.orig/pcimodules.c 1970-01-01 07:00:00.000000000 +0700
+++ pciutils-3.0.3/pcimodules.c 2008-12-01 13:38:39.000000000 +0700
@@ -0,0 +1,184 @@
+/*
+ * 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 <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;
+
+const char program_name[] = "pcimodules";
+
+#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.*/
+
+static 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;
+}
diff -Naur pciutils-3.0.3.orig/pcimodules.man pciutils-3.0.3/pcimodules.man
--- pciutils-3.0.3.orig/pcimodules.man 1970-01-01 07:00:00.000000000 +0700
+++ pciutils-3.0.3/pcimodules.man 2008-12-01 13:38:39.000000000 +0700
@@ -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).

220
pciutils.spec Normal file
View File

@ -0,0 +1,220 @@
%define libmajver %(echo %version | cut -d. -f1)
Name: pciutils
Version: 3.2.1
Release: 1mamba
Summary: A library for portable access to PCI bus configuration space
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
Source: ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/%{name}-%{version}.tar.gz
Patch1: %{name}-3.1.0-pcimodules.patch
Patch2: %{name}-3.1.2-pcimodules.patch
Patch3: %{name}-2.2.1-idpath.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: bash
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
Requires: libpci = %{version}-%{release}
Requires: hwdata
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
The PCI Utilities package contains a library for portable access to PCI bus configuration space and several utilities based on this library.
Current version works only on Linux and FreeBSD, but it can be easily extended to work on other systems as well.
The utilities include: (See manual pages for more details) :
lspci - displays detailed information about all PCI busses and devices in the system, replacing the original /proc/pci interface.
setpci - allows to read from and write to PCI device configuration registers. For example, you can adjust the latency timers with it.
The library (and therefore all the utilities) - can access PCI registers either via the /proc/bus/pci interface present since Linux 2.1.82 or via direct hardware access (to be used with older kernels and also for hardware diagnostics).
It's also capable of reading and interpreting register dumps printed by `lspci -x'.
%package -n libpci
Summary: Linux PCI access library
Group: System/Libraries
%description -n libpci
A library for inspecting and setting devices connected to the PCI bus.
%package -n libpci-devel
Summary: Linux PCI development library
Group: Development/Libraries
Requires: libpci = %{version}-%{release}
Obsoletes: %{name}-devel
%description -n libpci-devel
A library for inspecting and setting devices connected to the PCI bus.
This package contains the static library and include files for development.
%prep
%setup -q
#%patch1 -p1
#%patch2 -p1
#%patch3 -p1
%build
# disable zlib as long as HAL wants pci.id uncompressed
%make \
%if "%{_host}" != "%{_build}"
CROSS_COMPILE=%{_host}- \
HOST=%{_host} \
%else
CC=%{_host}-gcc \
%endif
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
SBINDIR=%{_sbindir} \
SHAREDIR=%{_datadir} \
MANDIR=%{_mandir} \
ZLIB=no \
SHARED=no \
IDSDIR=%{_datadir}/hwdata \
all
mv lib/libpci.a lib/libpci.a.toinstall
make clean
%make \
%if "%{_host}" != "%{_build}"
CROSS_COMPILE=%{_host}- \
HOST=%{_host} \
LDFLAGS="-lresolv" \
%else
CC=%{_host}-gcc \
%endif
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
SBINDIR=%{_sbindir} \
SHAREDIR=%{_datadir} \
MANDIR=%{_mandir} \
SHARED=yes \
ZLIB=no \
IDSDIR=%{_datadir}/hwdata \
all
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall \
install-lib \
SHARED=no \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
IDSDIR=%{_datadir}/hwdata
#install -m0755 pcimodules %{buildroot}%{_sbindir}
#install -m0644 pcimodules.man %{buildroot}%{_mandir}/man8/pcimodules.8
install lib/libpci.a.toinstall %{buildroot}%{_libdir}/libpci.a
ln -s libpci.so.%{version} %{buildroot}%{_libdir}/libpci.so
ln -s libpci.so.%{version} %{buildroot}%{_libdir}/libpci.so.%{libmajver}
install -d %{buildroot}%{_bindir}
ln -s ../sbin/lspci %{buildroot}%{_bindir}/lspci
rm -rf %{buildroot}%{_datadir}/hwdata
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%{_bindir}/lspci
%{_sbindir}/lspci
#%{_sbindir}/pcimodules
%{_sbindir}/setpci
%{_sbindir}/update-pciids
%{_mandir}/man7/pcilib.*
%{_mandir}/man8/*
%files -n libpci
%defattr(-,root,root)
%{_libdir}/libpci.so.*
%doc COPYING
%files -n libpci-devel
%defattr(-,root,root)
%{_libdir}/libpci.a
%{_libdir}/libpci.so
%dir %{_includedir}/pci
%{_includedir}/pci/*.h
%{_libdir}/pkgconfig/libpci.pc
%doc README ChangeLog pciutils.lsm
%changelog
* Fri Nov 15 2013 Automatic Build System <autodist@mambasoft.it> 3.2.1-1mamba
- automatic update by autodist
* Sun Apr 21 2013 Automatic Build System <autodist@mambasoft.it> 3.2.0-1mamba
- automatic version update by autodist
* Wed Aug 08 2012 Automatic Build System <autodist@mambasoft.it> 3.1.10-1mamba
- automatic version update by autodist
* Mon Oct 31 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.8-2mamba
- added patch to read pci.ids from %{_datadir}/hwdata/ and added requirement for hwdata
* Fri Oct 07 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.8-1mamba
- update to 3.1.8
- added /usr/bin/lspci symlink
- updates pci.ids db
* Fri Aug 13 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.7-1mamba
- update to 3.1.7
* Tue Jan 12 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.4-1mamba
- update to 3.1.4
* Tue Jul 07 2009 Davide Madrisan <davide.madrisan@gmail.com> 3.1.3-2mamba
- removed 'obsoletes libpci' in pciutils
- force pciutils to require libpci with same version and release
* Mon Jul 06 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 3.1.3-1mamba
- update to 3.1.3
* Mon May 18 2009 Automatic Build System <autodist@mambasoft.it> 3.1.2-1mamba
- automatic update by autodist
* Tue Dec 30 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 3.0.3-1mamba
- automatic update by autodist
* Tue Jan 08 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.9-3mamba
- shared library removed (unsupported upstream) see:
http://lists.alioth.debian.org/pipermail/pkg-pciutils-discuss/2006-November/000134.html
http://lists.alioth.debian.org/pipermail/pkg-pciutils-discuss/2006-March/000004.html
* Tue Jan 08 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.9-2mamba
- fix install so to install pkconfig file
- added pcimodules patch
* Wed Dec 19 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.9-1mamba
- update to 2.2.9
- removed pcimodules patch and executable
* Tue Oct 24 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.4-1qilnx
- update to version 2.2.4 by autospec
- fix shared library build: add soname option
* Sun Jul 09 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.3-1qilnx
- update to version 2.2.3 by autospec
- pciids update to date
* Tue May 02 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2.0-4qilnx
- fixed pcimodules patch
- pciids update
- build libpci as a shared library
* Fri Oct 07 2005 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 2.2.0-3qilnx
- pcimodules patched
* Thu Oct 06 2005 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 2.2.0-2qilnx
- file pci.ids updated added to sources
- devel package added
* Tue Sep 27 2005 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 2.2.0-1qilnx
- update to version 2.2.0 by autospec
* Mon Jul 02 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.1.11-2qilnx
- added PCI-modules patch for hotplug
* Mon Jun 23 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.1.11-1qilnx
- first build of PCI-utils