Update: pciutils-3.2.1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Update: pciutils-3.2.1

David Coppa

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?

Ciao,
David

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/pciutils/Makefile,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 Makefile
--- Makefile 19 Mar 2014 13:28:57 -0000 1.16
+++ Makefile 18 Aug 2014 06:01:22 -0000
@@ -4,7 +4,7 @@ NOT_FOR_ARCHS = sparc m88k vax
 
 COMMENT = PCI bus configuration register access tools
 
-DISTNAME = pciutils-3.1.9
+DISTNAME = pciutils-3.2.1
 CATEGORIES = sysutils
 
 HOMEPAGE = http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/pciutils/distinfo,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 distinfo
--- distinfo 11 Jul 2012 18:17:52 -0000 1.6
+++ distinfo 18 Aug 2014 06:01:22 -0000
@@ -1,5 +1,2 @@
-MD5 (pciutils-3.1.9.tar.gz) = 6Vj1/7k7EpcpZDgcOPJ+sw==
-RMD160 (pciutils-3.1.9.tar.gz) = U20qBUd+skLUNKlplbXiLp0vkKY=
-SHA1 (pciutils-3.1.9.tar.gz) = aw/HPsD+ak+krLfasT86g/OkUJg=
-SHA256 (pciutils-3.1.9.tar.gz) = iufTIMUPArAV9eK7F6n4Fc8gHa6BtrvUa4pFVS0AoXg=
-SIZE (pciutils-3.1.9.tar.gz) = 340215
+SHA256 (pciutils-3.2.1.tar.gz) = sxExtyH6JjeLSvYbHEmYb/QP5ZC8IQVFshC2t3QzeFg=
+SIZE (pciutils-3.2.1.tar.gz) = 367046
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/sysutils/pciutils/patches/patch-Makefile,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-Makefile
--- patches/patch-Makefile 11 Jul 2012 18:17:52 -0000 1.4
+++ patches/patch-Makefile 18 Aug 2014 06:01:22 -0000
@@ -1,20 +1,20 @@
---- Makefile.orig Sat Jan 14 11:07:55 2012
-+++ Makefile Fri Jun 29 10:19:48 2012
+--- Makefile.orig Sun Nov 10 13:22:09 2013
++++ Makefile Thu Aug 14 07:52:15 2014
 @@ -1,8 +1,7 @@
  # Makefile for The PCI Utilities
- # (c) 1998--2012 Martin Mares <[hidden email]>
+ # (c) 1998--2013 Martin Mares <[hidden email]>
 
 -OPT=-O2
 -CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
 +CFLAGS+= -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
 
- VERSION=3.1.9
- DATE=2012-01-14
-@@ -105,7 +104,6 @@ install: all
+ VERSION=3.2.1
+ DATE=2013-11-10
+@@ -112,7 +111,6 @@ install: all
  $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
  $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
  $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
 - $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7
  ifeq ($(SHARED),yes)
- $(DIRINSTALL) -m 755 $(DESTDIR)$(LIBDIR)
- $(INSTALL) -c -m 644 lib/$(PCILIB) $(DESTDIR)$(LIBDIR)
+ ln -sf $(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
+ endif
Index: patches/patch-lib_names-net_c
===================================================================
RCS file: /cvs/ports/sysutils/pciutils/patches/patch-lib_names-net_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-lib_names-net_c
--- patches/patch-lib_names-net_c 11 Jul 2012 18:17:52 -0000 1.2
+++ patches/patch-lib_names-net_c 18 Aug 2014 06:01:22 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-lib_names-net_c,v 1.2 2012/07/11 18:17:52 gonzalo Exp $
---- lib/names-net.c.orig Fri Jan  7 18:04:28 2011
-+++ lib/names-net.c Fri Jun 29 10:19:48 2012
-@@ -194,7 +194,7 @@ char
+--- lib/names-net.c.orig Mon Apr  1 21:25:47 2013
++++ lib/names-net.c Thu Aug 14 07:52:15 2014
+@@ -195,7 +195,7 @@ char
        resolver_inited = 1;
        res_init();
      }
@@ -10,7 +10,7 @@ $OpenBSD: patch-lib_names-net_c,v 1.2 20
    if (res < 0)
      {
        a->debug("\tfailed, h_errno=%d\n", h_errno);
-@@ -208,7 +208,7 @@ char
+@@ -209,7 +209,7 @@ char
    dns_init_section(&ds, DNS_SEC_ANSWER);
    while (dns_parse_rr(&ds) > 0)
      {
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);
++  }
+ }
+
+ 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");
    }

Reply | Threaded
Open this post in threaded view
|

Re: Update: pciutils-3.2.1

Jeremie Courreges-Anglas-2
David Coppa <[hidden email]> 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).

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

Reply | Threaded
Open this post in threaded view
|

Re: Update: pciutils-3.2.1

Matthieu Herrb
On Mon, Aug 18, 2014 at 01:26:27PM +0200, Jérémie Courrèges-Anglas wrote:

> David Coppa <[hidden email]> 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).
>
> OK with me, but I'd find the following addition useful:

I'm ok with either version.

>
>
> [...]
>
> > 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

Reply | Threaded
Open this post in threaded view
|

Re: Update: pciutils-3.2.1

Matthieu Herrb
In reply to this post by Jeremie Courreges-Anglas-2
On Mon, Aug 18, 2014 at 01:26:27PM +0200, Jérémie Courrèges-Anglas wrote:

> David Coppa <[hidden email]> 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