On Mon, Aug 18, 2014 at 01:26:27PM +0200, Jérémie Courrèges-Anglas wrote:
> David Coppa <[email protected]> writes:
>
> > Hi!
> >
> > Update to pciutils-3.2.1 and add a patch to make it work with
> > machdep.allowaperture=0 (for reading at least, code borrowed from
> > libpciaccess).
> >
> > OK?
>
> Works fine on amd64, builds fine on sparc64 (but not pci bus to
> test).
It's broken on sparc64 but it's been like that like forever:
4475 lspci CALL ioctl(0x3,PCIOCREAD,0xfffffffffffef8a8)
4475 lspci RET ioctl -1 errno 22 Invalid argument
also on machines with multiple PCI domains, it can't list anything but
the 0 domain, but this is also an old problem.
Still ok from me for the cases where pcidump confuse people from 3rd
party software.
>
> OK with me, but I'd find the following addition useful:
>
>
> [...]
>
> > Index: patches/patch-lib_obsd-device_c
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/pciutils/patches/patch-lib_obsd-device_c,v
> > retrieving revision 1.4
> > diff -u -p -u -p -r1.4 patch-lib_obsd-device_c
> > --- patches/patch-lib_obsd-device_c 11 Jul 2012 18:17:52 -0000 1.4
> > +++ patches/patch-lib_obsd-device_c 18 Aug 2014 06:01:22 -0000
> > @@ -1,7 +1,23 @@
> > $OpenBSD: patch-lib_obsd-device_c,v 1.4 2012/07/11 18:17:52 gonzalo Exp $
> > ---- lib/obsd-device.c.orig Fri Jan 7 18:04:28 2011
> > -+++ lib/obsd-device.c Fri Jun 29 10:19:48 2012
> > -@@ -56,11 +56,6 @@ static int
> > +--- lib/obsd-device.c.orig Fri Jan 7 22:04:28 2011
> > ++++ lib/obsd-device.c Thu Aug 14 07:58:21 2014
> > +@@ -41,9 +41,12 @@ obsd_init(struct pci_access *a)
> > + {
> > + char *name = pci_get_param(a, "obsd.path");
> > +
> > +- a->fd = open(name, O_RDWR, 0);
> > +- if (a->fd < 0)
> > +- a->error("obsd_init: %s open failed", name);
> > ++ a->fd = open(name, O_RDWR | O_CLOEXEC);
> > ++ if (a->fd == -1) {
> > ++ a->fd = open(name, O_RDONLY | O_CLOEXEC);
> > ++ if (a->fd == -1)
> > ++ a->error("obsd_init: %s open failed", name);
>
> What about
>
> ++ a->error("obsd_init: %s open failed (%s)", name, strerror(errno));
>
> This file already includes errno.h and string.h
> The result would be something like:
>
> lspci: obsd_init: /dev/pci open failed (Device not configured)
>
> > ++ }
> > + }
> > +
> > + static void
> > +@@ -56,11 +59,6 @@ static int
> > obsd_read(struct pci_dev *d, int pos, byte *buf, int len)
> > {
> > struct pci_io pi;
> > @@ -13,7 +29,7 @@ $OpenBSD: patch-lib_obsd-device_c,v 1.4
> >
> > if (!(len == 1 || len == 2 || len == 4))
> > return pci_generic_block_read(d, pos, buf, len);
> > -@@ -81,18 +76,16 @@ obsd_read(struct pci_dev *d, int pos, byte *buf, int l
> > +@@ -81,18 +79,16 @@ obsd_read(struct pci_dev *d, int pos, byte *buf, int l
> > else
> > d->access->error("obsd_read: ioctl(PCIOCREAD) failed");
> > }
> >
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
>
--
Matthieu Herrb