Update to pciutils 2.2.4. With help and testing from steven@

This commit is contained in:
matthieu 2006-12-30 14:55:25 +00:00
parent f67ceb2007
commit 8da8bb5109
10 changed files with 51 additions and 245 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.2 2006/12/12 20:32:36 kettenis Exp $
# $OpenBSD: Makefile,v 1.3 2006/12/30 14:55:25 matthieu Exp $
NOT_FOR_ARCHS= sparc m68k m88k vax
COMMENT= "PCI bus configuration register access tools"
DISTNAME= pciutils-2.2.1
PKGNAME= ${DISTNAME}p0
DISTNAME= pciutils-2.2.4
CATEGORIES= sysutils
HOMEPAGE= http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
@ -24,7 +23,7 @@ MASTER_SITES= ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/
USE_GMAKE= Yes
MAKE_ENV= CC="${CC}"
FAKE_FLAGS= PREFIX=${WRKINST}${PREFIX}
FAKE_FLAGS= PREFIX=${PREFIX}
NO_REGRESS= Yes

View File

@ -1,4 +1,4 @@
MD5 (pciutils-2.2.1.tar.gz) = c18e2a5f04e9abae5a42439de294f086
RMD160 (pciutils-2.2.1.tar.gz) = fc12da1261a33f03fc54e4bcc48cd0b8277990a6
SHA1 (pciutils-2.2.1.tar.gz) = 01ae9a2c826e06d48d2b0d8f78cfddf7e1cadb4c
SIZE (pciutils-2.2.1.tar.gz) = 194389
MD5 (pciutils-2.2.4.tar.gz) = 5629fdb049f189fb853e7021f85553d2
RMD160 (pciutils-2.2.4.tar.gz) = 27db4b23a07a02b28b64e01fbe1c74cefa887cc0
SHA1 (pciutils-2.2.4.tar.gz) = c20dfa13bbd3d04ce921294c51e3da94140cea8b
SIZE (pciutils-2.2.4.tar.gz) = 210706

View File

@ -1,13 +1,13 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- Makefile.orig Sat Nov 26 14:00:57 2005
+++ Makefile Fri Mar 24 22:57:18 2006
$OpenBSD: patch-Makefile,v 1.2 2006/12/30 14:55:25 matthieu Exp $
--- Makefile.orig Sat Sep 9 14:57:03 2006
+++ Makefile Wed Nov 22 22:43:48 2006
@@ -1,8 +1,7 @@
# Makefile for The PCI Utilities
# (c) 1998--2005 Martin Mares <mj@ucw.cz>
# (c) 1998--2006 Martin Mares <mj@ucw.cz>
-OPT=-O2
-CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
+CFLAGS+= -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
-CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS+= -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
VERSION=2.2.1
DATE=2005-11-26
VERSION=2.2.4
DATE=2006-09-09

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-lib_Makefile,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- lib/Makefile.orig Fri Aug 13 22:29:06 2004
+++ lib/Makefile Wed Mar 22 23:20:03 2006
@@ -36,6 +36,10 @@ CFLAGS += -I${FREEBSD_SYS}
endif
endif
+ifdef PCI_HAVE_PM_OBSD_DEVICE
+OBJS += obsd-device.o
+endif
+
ifdef PCI_HAVE_PM_AIX_DEVICE
OBJS += aix-device.o
endif

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-lib_access_c,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- lib/access.c.orig Fri Aug 13 22:15:11 2004
+++ lib/access.c Tue Mar 21 22:56:47 2006
@@ -47,6 +47,11 @@ static struct pci_methods *pci_methods[P
#else
NULL,
#endif
+#ifdef PCI_HAVE_PM_OBSD_DEVICE
+ &pm_obsd_device,
+#else
+ NULL,
+#endif
#ifdef PCI_HAVE_PM_DUMP
&pm_dump,
#else

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-lib_configure,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- lib/configure.orig Wed Sep 21 13:42:03 2005
+++ lib/configure Tue Mar 21 22:56:47 2006
@@ -74,6 +74,12 @@ case $sys in
echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"'
ok=1
;;
+ openbsd)
+ echo_n " obsd-device"
+ echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE'
+ echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"'
+ ok=1
+ ;;
aix)
echo_n " aix-device"
echo >>$c '#define PCI_HAVE_PM_AIX_DEVICE'

View File

@ -1,10 +0,0 @@
$OpenBSD: patch-lib_internal_h,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- lib/internal.h.orig Fri Aug 13 22:21:22 2004
+++ lib/internal.h Tue Mar 21 22:56:47 2006
@@ -36,4 +36,5 @@ struct pci_dev *pci_alloc_dev(struct pci
int pci_link_dev(struct pci_access *, struct pci_dev *);
extern struct pci_methods pm_intel_conf1, pm_intel_conf2, pm_linux_proc,
- pm_fbsd_device, pm_aix_device, pm_nbsd_libpci, pm_dump, pm_linux_sysfs;
+ pm_fbsd_device, pm_aix_device, pm_nbsd_libpci, pm_obsd_device,
+ pm_dump, pm_linux_sysfs;

View File

@ -1,164 +1,37 @@
$OpenBSD: patch-lib_obsd-device_c,v 1.2 2006/12/12 20:32:37 kettenis Exp $
--- lib/obsd-device.c.orig Wed Nov 22 20:07:11 2006
+++ lib/obsd-device.c Tue Dec 12 12:03:49 2006
@@ -0,0 +1,160 @@
+/*
+ * The PCI Library -- FreeBSD /dev/pci access
+ *
+ * Copyright (c) 1999 Jari Kirma <kirma@cs.hut.fi>
+ * Updated in 2003 by Samy Al Bahra <samy@kerneled.com>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/pciio.h>
+#include "internal.h"
+
+static void
+obsd_config(struct pci_access *a)
+{
+ a->method_params[PCI_ACCESS_OBSD_DEVICE] = PCI_PATH_OBSD_DEVICE;
+}
+
+static int
+obsd_detect(struct pci_access *a)
+{
+ char *name = a->method_params[PCI_ACCESS_OBSD_DEVICE];
+
+ if (access(name, R_OK))
+ {
+ a->warning("Cannot open %s", name);
+ return 0;
+ }
+ a->debug("...using %s", name);
+ return 1;
+}
+
+static void
+obsd_init(struct pci_access *a)
+{
+ char *name = a->method_params[PCI_ACCESS_OBSD_DEVICE];
+
+ a->fd = open(name, O_RDWR, 0);
+ if (a->fd < 0)
+ {
+ a->error("obsd_init: %s open failed", name);
+ }
+}
+
+static void
+obsd_cleanup(struct pci_access *a)
+{
+ close(a->fd);
+}
+
+static int
+obsd_read(struct pci_dev *d, int pos, byte *buf, int len)
+{
+ struct pci_io pi;
+ union {
+ u_int32_t u32;
+ u_int16_t u16[2];
+ u_int8_t u8[4];
+ } u;
+
+ if (!(len == 1 || len == 2 || len == 4))
+ {
+ return pci_generic_block_read(d, pos, buf, len);
+ }
+
+ if (pos >= 256)
+ return 0;
+
+ pi.pi_sel.pc_bus = d->bus;
+ pi.pi_sel.pc_dev = d->dev;
+ pi.pi_sel.pc_func = d->func;
+
+ pi.pi_reg = pos - (pos % 4);
+ pi.pi_width = 4;
+
+ if (ioctl(d->access->fd, PCIOCREAD, &pi) < 0) {
+ if (errno == ENXIO) {
+ pi.pi_data = 0xffffffff;
+ } else {
+ d->access->error("obsd_read: ioctl(PCIOCREAD) failed");
+ }
+ }
+ u.u32 = pi.pi_data;
+
+ switch (len)
+ {
+ case 1:
$OpenBSD: patch-lib_obsd-device_c,v 1.3 2006/12/30 14:55:25 matthieu Exp $
--- lib/obsd-device.c.orig Sat Sep 9 12:53:01 2006
+++ lib/obsd-device.c Sat Dec 16 16:13:26 2006
@@ -58,11 +58,6 @@ static int
obsd_read(struct pci_dev *d, int pos, byte *buf, int len)
{
struct pci_io pi;
- union {
- u_int32_t u32;
- u_int16_t u16[2];
- u_int8_t u8[4];
- } u;
if (!(len == 1 || len == 2 || len == 4))
{
@@ -86,18 +81,16 @@ obsd_read(struct pci_dev *d, int pos, by
d->access->error("obsd_read: ioctl(PCIOCREAD) failed");
}
}
- u.u32 = pi.pi_data;
-
switch (len)
{
case 1:
- buf[0] = (u8) u.u8[pos % 4];
+ buf[0] = (u8) (pi.pi_data >> ((pos % 4) * 8));
+ break;
+ case 2:
break;
case 2:
- ((u16 *) buf)[0] = letoh16(u.u16[(pos % 4) / 2]);
+ ((u16 *) buf)[0] = (u16) htole16(pi.pi_data >> ((pos % 4) * 8));
+ break;
+ case 4:
break;
case 4:
- ((u32 *) buf)[0] = (u32) letoh32(pi.pi_data);
+ ((u32 *) buf)[0] = (u32) htole32(pi.pi_data);
+ break;
+ }
+ return 1;
+}
+
+static int
+obsd_write(struct pci_dev *d, int pos, byte *buf, int len)
+{
+ struct pci_io pi;
+
+ if (!(len == 1 || len == 2 || len == 4))
+ {
+ return pci_generic_block_write(d, pos, buf, len);
+ }
+
+ if (pos >= 256)
+ return 0;
+
+ pi.pi_sel.pc_bus = d->bus;
+ pi.pi_sel.pc_dev = d->dev;
+ pi.pi_sel.pc_func = d->func;
+
+ pi.pi_reg = pos;
+ pi.pi_width = len;
+
+ switch (len)
+ {
+ case 1:
+ pi.pi_data = buf[0];
+ break;
+ case 2:
+ pi.pi_data = ((u16 *) buf)[0];
+ break;
+ case 4:
+ pi.pi_data = ((u32 *) buf)[0];
+ break;
+ }
+
+ if (ioctl(d->access->fd, PCIOCWRITE, &pi) < 0)
+ {
+ d->access->error("obsd_write: ioctl(PCIOCWRITE) failed");
+ }
+
+ return 1;
+}
+
+struct pci_methods pm_obsd_device = {
+ "OpenBSD-device",
+ obsd_config,
+ obsd_detect,
+ obsd_init,
+ obsd_cleanup,
+ pci_generic_scan,
+ pci_generic_fill_info,
+ obsd_read,
+ obsd_write,
+ NULL, /* dev_init */
+ NULL /* dev_cleanup */
+};
break;
}
return 1;

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-lib_pci_h,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
--- lib/pci.h.orig Sat Sep 10 14:10:54 2005
+++ lib/pci.h Tue Mar 21 22:56:47 2006
@@ -31,6 +31,7 @@ enum pci_access_type {
PCI_ACCESS_FBSD_DEVICE, /* FreeBSD /dev/pci (params: path) */
PCI_ACCESS_AIX_DEVICE, /* /dev/pci0, /dev/bus0, etc. */
PCI_ACCESS_NBSD_LIBPCI, /* NetBSD libpci */
+ PCI_ACCESS_OBSD_DEVICE, /* OpenBSD /dev/pci */
PCI_ACCESS_DUMP, /* Dump file (params: filename) */
PCI_ACCESS_MAX
};

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2006/03/25 21:53:35 matthieu Exp $
@comment $OpenBSD: PLIST,v 1.2 2006/12/30 14:55:25 matthieu Exp $
@man man/man8/lspci.8
@man man/man8/setpci.8
@man man/man8/update-pciids.8
@ -6,4 +6,4 @@ sbin/lspci
sbin/setpci
sbin/update-pciids
@comment no checksum
share/pci.ids
share/pci.ids.gz