pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/libpciaccess Import libpciaccess-0.10.4 (X.or...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/729b37129867
branches:  trunk
changeset: 549266:729b37129867
user:      bjs <bjs%pkgsrc.org@localhost>
date:      Thu Oct 30 20:58:11 2008 +0000

description:
Import libpciaccess-0.10.4 (X.org PCI wrapper library) + patches.
Tested on NetBSD-current (i386 and amd64); support for
other architectures is in the works.

Currently this should work with:

ONLY_FOR_PLATFORM=      FreeBSD-*-i386 NetBSD-*-i386 OpenBSD-*-i386
ONLY_FOR_PLATFORM+=     FreeBSD-*-x86_64 NetBSD-*-x86_64 OpenBSD-*-x86_64
ONLY_FOR_PLATFORM+=     DragonFly-i386-* DragonFly-x86_64-*
ONLY_FOR_PLATFORM+=     Linux-*-* SunOS-*-*

diffstat:

 sysutils/libpciaccess/DESCR            |    2 +
 sysutils/libpciaccess/Makefile         |   36 ++++
 sysutils/libpciaccess/PLIST            |    4 +
 sysutils/libpciaccess/buildlink3.mk    |   19 ++
 sysutils/libpciaccess/distinfo         |    9 +
 sysutils/libpciaccess/patches/patch-aa |   26 +++
 sysutils/libpciaccess/patches/patch-ab |   12 +
 sysutils/libpciaccess/patches/patch-ac |  247 +++++++++++++++++++++++++++++++++
 sysutils/libpciaccess/patches/patch-ad |   12 +
 9 files changed, 367 insertions(+), 0 deletions(-)

diffs (truncated from 403 to 300 lines):

diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/DESCR       Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,2 @@
+The pciaccess library wraps platform-dependent PCI access methods
+in a convenient library.
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/Makefile    Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,36 @@
+# $NetBSD: Makefile,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+#
+
+DISTNAME=      libpciaccess-0.10.4
+CATEGORIES=    sysutils x11
+MASTER_SITES=  ${MASTER_SITE_XORG:=lib/}
+EXTRACT_SUFX=  .tar.bz2
+
+MAINTAINER=    bjs%NetBSD.org@localhost
+HOMEPAGE=      http://xorg.freedesktop.org/
+COMMENT=       PCI access utility library from X.org
+
+PKG_DESTDIR_SUPPORT=   user-destdir
+###
+### XXX This list is probably not exhaustive.
+###
+ONLY_FOR_PLATFORM=     FreeBSD-*-i386 NetBSD-*-i386 OpenBSD-*-i386
+ONLY_FOR_PLATFORM+=    FreeBSD-*-x86_64 NetBSD-*-x86_64 OpenBSD-*-x86_64
+ONLY_FOR_PLATFORM+=    DragonFly-i386-* DragonFly-x86_64-*
+ONLY_FOR_PLATFORM+=    Linux-*-* SunOS-*-*
+
+GNU_CONFIGURE= yes
+USE_LIBTOOL=   yes
+USE_TOOLS+=    pkg-config
+###
+### XXX When our patches make it upstream, this will no longer be
+###    necessary.
+###
+USE_TOOLS+=    autoconf automake autoreconf
+
+PKGCONFIG_OVERRIDE+=   pciaccess.pc.in
+
+pre-configure:
+       cd ${WRKSRC} && autoreconf -v -i -f
+
+.include "../../mk/bsd.pkg.mk"
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/PLIST       Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+include/pciaccess.h
+lib/libpciaccess.la
+lib/pkgconfig/pciaccess.pc
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/buildlink3.mk       Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+
+BUILDLINK_DEPTH:=              ${BUILDLINK_DEPTH}+
+LIBPCIACCESS_BUILDLINK3_MK:=   ${LIBPCIACCESS_BUILDLINK3_MK}+
+
+.if ${BUILDLINK_DEPTH} == "+"
+BUILDLINK_DEPENDS+=    libpciaccess
+.endif
+
+BUILDLINK_PACKAGES:=   ${BUILDLINK_PACKAGES:Nlibpciaccess}
+BUILDLINK_PACKAGES+=   libpciaccess
+BUILDLINK_ORDER:=      ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}libpciaccess
+
+.if ${LIBPCIACCESS_BUILDLINK3_MK} == "+"
+BUILDLINK_API_DEPENDS.libpciaccess+=   libpciaccess>=0.10.4
+BUILDLINK_PKGSRCDIR.libpciaccess?=     ../../sysutils/libpciaccess
+.endif # LIBPCIACCESS_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:=              ${BUILDLINK_DEPTH:S/+$//}
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/distinfo    Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+
+SHA1 (libpciaccess-0.10.4.tar.bz2) = e5dbfca1d0a767ad9d0278c7e8ba551c90d9c980
+RMD160 (libpciaccess-0.10.4.tar.bz2) = fe398273b491e6ba06dcdaf506721e02ed295f0c
+Size (libpciaccess-0.10.4.tar.bz2) = 256407 bytes
+SHA1 (patch-aa) = 6b8be37409cda8068e214b137d944a09a107ed8a
+SHA1 (patch-ab) = 3ff43112679d8e66e2f00fe706c332a401335ff5
+SHA1 (patch-ac) = c95282a53b5b2bd3eb5f2e233c45d44be997de24
+SHA1 (patch-ad) = 241890e819177262d9207cdb26f23aafd614e1da
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/patches/patch-aa    Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-aa,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+
+--- configure.ac.orig  2008-10-17 16:59:42.000000000 -0400
++++ configure.ac
+@@ -116,7 +116,21 @@ AM_CONDITIONAL(NETBSD, [test "x$netbsd" 
+ AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
+ AM_CONDITIONAL(SOLARIS, [test "x$solaris" = xyes])
+ 
++if test "x$netbsd" = xyes; then
++AC_CHECK_LIB([pci], [pcibus_conf_read],
++  [PCIACCESS_LIBS="-lpci $PCIACCESS_LIBS"],
++  [AC_MSG_ERROR(check for libpci failed.)])
++AC_CHECK_HEADERS([machine/sysarch.h], [],
++  [AC_MSG_ERROR(sysarch.h not found)])
++AC_CHECK_HEADERS([machine/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"],
++[#ifdef HAVE_MACHINE_SYSARCH_H
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++])
++else
+ AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"])
++fi
+ 
+ if test "x$have_mtrr_h" = xyes; then
+     AC_DEFINE(HAVE_MTRR, 1, [Use MTRRs on mappings])
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/patches/patch-ab    Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,12 @@
+$NetBSD: patch-ab,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+
+--- src/freebsd_pci.c.orig     2008-10-15 18:35:53.000000000 -0400
++++ src/freebsd_pci.c
+@@ -43,6 +43,7 @@
+ #include <sys/mman.h>
+ #include <sys/memrange.h>
+ 
++#include "config.h"
+ #include "pciaccess.h"
+ #include "pciaccess_private.h"
+ 
diff -r 2da0dae193de -r 729b37129867 sysutils/libpciaccess/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/libpciaccess/patches/patch-ac    Thu Oct 30 20:58:11 2008 +0000
@@ -0,0 +1,247 @@
+$NetBSD: patch-ac,v 1.1.1.1 2008/10/30 20:58:11 bjs Exp $
+
+--- src/netbsd_pci.c.orig      2008-10-15 18:35:53.000000000 -0400
++++ src/netbsd_pci.c
+@@ -1,5 +1,4 @@
+-/*
+- * Copyright (c) 2008 Juan Romero Pardines
++/* Copyright (c) 2008 Blair Sadewitz
+  * Copyright (c) 2008 Mark Kettenis
+  *
+  * Permission to use, copy, modify, and distribute this software for any
+@@ -20,12 +19,15 @@
+ #include <sys/mman.h>
+ #include <sys/types.h>
+ 
++#ifdef HAVE_MTRR
+ #include <machine/sysarch.h>
+ #include <machine/mtrr.h>
++#define netbsd_set_mtrr(mr, num)      _X86_SYSARCH_L(set_mtrr)(mr, num)
++#endif
+ 
++#include <dev/pci/pcidevs.h>
+ #include <dev/pci/pciio.h>
+ #include <dev/pci/pcireg.h>
+-#include <dev/pci/pcidevs.h>
+ 
+ #include <errno.h>
+ #include <fcntl.h>
+@@ -35,6 +37,8 @@
+ #include <unistd.h>
+ 
+ 
++#include <pci.h>
++
+ #include "pciaccess.h"
+ #include "pciaccess_private.h"
+ 
+@@ -43,20 +47,12 @@ static int pcifd;
+ static int
+ pci_read(int bus, int dev, int func, uint32_t reg, uint32_t *val)
+ {
+-      struct pciio_bdf_cfgreg io;
+-      int err;
++      uint32_t rval;
+ 
+-      bzero(&io, sizeof(io));
+-      io.bus = bus;
+-      io.device = dev;
+-      io.function = func;
+-      io.cfgreg.reg = reg;
++      if (pcibus_conf_read(pcifd, bus, dev, func, reg, &rval) == -1)
++              return (-1);
+ 
+-      err = ioctl(pcifd, PCI_IOC_BDF_CFGREAD, &io);
+-      if (err)
+-              return (err);
+-
+-      *val = io.cfgreg.val;
++      *val = rval;
+ 
+       return 0;
+ }
+@@ -64,16 +60,7 @@ pci_read(int bus, int dev, int func, uin
+ static int
+ pci_write(int bus, int dev, int func, uint32_t reg, uint32_t val)
+ {
+-      struct pciio_bdf_cfgreg io;
+-
+-      bzero(&io, sizeof(io));
+-      io.bus = bus;
+-      io.device = dev;
+-      io.function = func;
+-      io.cfgreg.reg = reg;
+-      io.cfgreg.val = val;
+-
+-      return ioctl(pcifd, PCI_IOC_BDF_CFGWRITE, &io);
++      return pcibus_conf_write(pcifd, bus, dev, func, reg, val);
+ }
+ 
+ static int
+@@ -91,70 +78,68 @@ static int
+ pci_device_netbsd_map_range(struct pci_device *dev,
+     struct pci_device_mapping *map)
+ {
+-      struct mtrr mtrr;
+-      int fd, error, nmtrr, prot = PROT_READ;
++#ifdef HAVE_MTRR
++      struct mtrr m;
++      int n = 1;
++#endif
++      int prot, fd, ret = 0;
+ 
+-      if ((fd = open("/dev/mem", O_RDWR)) == -1)
+-              return errno;
++      prot = PROT_READ;
+ 
+       if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
+               prot |= PROT_WRITE;
+ 
+-      map->memory = mmap(NULL, map->size, prot, MAP_SHARED,
+-          fd, map->base);
++      fd = open("/dev/mem", O_RDWR);
++      if (fd == -1)
++              return errno;
++      map->memory = mmap(NULL, map->size, prot, MAP_SHARED, fd, map->base);
+       if (map->memory == MAP_FAILED)
+               return errno;
+ 
++#ifdef HAVE_MTRR
++      memset(&m, 0, sizeof(m));
++
+       /* No need to set an MTRR if it's the default mode. */
+       if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
+           (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)) {
+-              mtrr.base = map->base;
+-              mtrr.len = map->size;
+-              mtrr.flags = MTRR_VALID;
+-
+-              if (map->flags & PCI_DEV_MAP_FLAG_CACHABLE)
+-                      mtrr.type = MTRR_TYPE_WB;
++              m.base = base;
++              m.flags = MTRR_VALID | MTRR_PRIVATE;
++              m.len = size;
++              m.owner = getpid();
++              if (map->flags & PCI_DEV_MAP_FLAG_CACHEABLE)
++                      m.type = MTRR_TYPE_WB;
+               if (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)
+-                      mtrr.type = MTRR_TYPE_WC;
+-#ifdef __i386__
+-              error = i386_set_mtrr(&mtrr, &nmtrr);
+-#endif
+-#ifdef __amd64__
+-              error = x86_64_set_mtrr(&mtrr, &nmtrr);
+-#endif
+-              if (error) {
+-                      close(fd);
+-                      return errno;
+-              }
++                      m.type = MTRR_TYPE_WC;
++
++              if ((netbsd_set_mtrr(&m, &n)) == -1)
++                      ret = errno;
+       }
++#endif
+ 
+       close(fd);
+ 
+-      return 0;
++      return ret;
+ }
+ 
+ static int
+ pci_device_netbsd_unmap_range(struct pci_device *dev,
+     struct pci_device_mapping *map)
+ {
+-      struct mtrr mtrr;
+-      int nmtrr, error;
++#ifdef HAVE_MTRR
++      struct mtrr m;
++      int n = 1;



Home | Main Index | Thread Index | Old Index