On Mon, Mar 22, 2010 at 01:16:02AM +1100, Jonathan Gray wrote: > We need to open the pci device O_RDONLY not O_RDWR for this > to work, otherwise the result is: > > lspci: obsd_init: /dev/pci open failed
Well you need machdep.allowaperture > 0 for open r/w to succeed. Are you sure pciutils never tries to write to pci config space? if so ok. > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/sysutils/pciutils/Makefile,v > retrieving revision 1.10 > diff -u -p -r1.10 Makefile > --- Makefile 30 Sep 2009 05:24:24 -0000 1.10 > +++ Makefile 5 Mar 2010 18:36:18 -0000 > @@ -5,7 +5,7 @@ NOT_FOR_ARCHS = sparc m68k m88k vax > COMMENT = PCI bus configuration register access tools > > DISTNAME = pciutils-3.1.2 > -PKGNAME = ${DISTNAME}p0 > +PKGNAME = ${DISTNAME}p1 > CATEGORIES = sysutils > > HOMEPAGE = http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml > Index: patches/patch-Makefile > =================================================================== > RCS file: /cvs/ports/sysutils/pciutils/patches/patch-Makefile,v > retrieving revision 1.3 > diff -u -p -r1.3 patch-Makefile > --- patches/patch-Makefile 30 Jan 2009 22:22:39 -0000 1.3 > +++ patches/patch-Makefile 5 Mar 2010 18:36:18 -0000 > @@ -1,16 +1,16 @@ > ---- Makefile.orig Sun Nov 9 21:28:18 2008 > -+++ Makefile Wed Jan 7 13:41:39 2009 > +--- Makefile.orig Sun Feb 1 17:49:22 2009 > ++++ Makefile Fri Mar 5 19:31:55 2010 > @@ -1,8 +1,7 @@ > # Makefile for The PCI Utilities > - # (c) 1998--2008 Martin Mares <m...@ucw.cz> > + # (c) 1998--2009 Martin Mares <m...@ucw.cz> > > -OPT=-O2 > -CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes > -Wmissing-prototypes > +CFLAGS+= -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes > > - VERSION=3.0.3 > - DATE=2008-11-09 > -@@ -97,7 +96,6 @@ > + VERSION=3.1.2 > + DATE=2009-02-01 > +@@ -105,7 +104,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 > Index: patches/patch-lib_names-net_c > =================================================================== > RCS file: /cvs/ports/sysutils/pciutils/patches/patch-lib_names-net_c,v > retrieving revision 1.1 > diff -u -p -r1.1 patch-lib_names-net_c > --- patches/patch-lib_names-net_c 30 Jan 2009 22:22:39 -0000 1.1 > +++ patches/patch-lib_names-net_c 5 Mar 2010 18:36:18 -0000 > @@ -1,6 +1,7 @@ > ---- lib/names-net.c.ori Wed Jan 7 12:50:25 2009 > -+++ lib/names-net.c Wed Jan 7 12:52:26 2009 > -@@ -194,7 +194,7 @@ > +$OpenBSD$ > +--- lib/names-net.c.orig Tue Nov 11 00:11:51 2008 > ++++ lib/names-net.c Fri Mar 5 19:31:55 2010 > +@@ -194,7 +194,7 @@ char > resolver_inited = 1; > res_init(); > } > @@ -9,7 +10,7 @@ > if (res < 0) > { > a->debug("\tfailed, h_errno=%d\n", h_errno); > -@@ -208,7 +208,7 @@ > +@@ -208,7 +208,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.3 > diff -u -p -r1.3 patch-lib_obsd-device_c > --- patches/patch-lib_obsd-device_c 30 Dec 2006 14:55:25 -0000 1.3 > +++ patches/patch-lib_obsd-device_c 5 Mar 2010 18:36:18 -0000 > @@ -1,7 +1,16 @@ > $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 > +--- lib/obsd-device.c.orig Fri Nov 21 22:00:38 2008 > ++++ lib/obsd-device.c Fri Mar 5 19:33:29 2010 > +@@ -41,7 +41,7 @@ obsd_init(struct pci_access *a) > + { > + char *name = pci_get_param(a, "obsd.path"); > + > +- a->fd = open(name, O_RDWR, 0); > ++ a->fd = open(name, O_RDONLY, 0); > + if (a->fd < 0) > + a->error("obsd_init: %s open failed", name); > + } > +@@ -56,11 +56,6 @@ static int > obsd_read(struct pci_dev *d, int pos, byte *buf, int len) > { > struct pci_io pi; > @@ -12,10 +21,10 @@ $OpenBSD: patch-lib_obsd-device_c,v 1.3 > - } u; > > if (!(len == 1 || len == 2 || len == 4)) > - { > -@@ -86,18 +81,16 @@ obsd_read(struct pci_dev *d, int pos, by > + 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 > + else > d->access->error("obsd_read: ioctl(PCIOCREAD) failed"); > - } > } > - u.u32 = pi.pi_data; > - -- Matthieu Herrb