pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/libpciaccess Add a minimal implementation of ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4502778175b6
branches:  trunk
changeset: 393738:4502778175b6
user:      drochner <drochner%pkgsrc.org@localhost>
date:      Mon May 25 20:11:05 2009 +0000

description:
Add a minimal implementation of the read_rom method for NetBSD, just
good enough to get newer xorg servers running.
(I need to double-check the PCI spec, but it is well possible that we
can't do much better anyway: ISTR the PCI spec allows devices to share
decoding ressources between ROM and runtime logics, which means there
is no safe way to read the original ROM at runtime. Correct me if
I'm wrong.)

diffstat:

 sysutils/libpciaccess/Makefile         |   3 +-
 sysutils/libpciaccess/distinfo         |   4 +-
 sysutils/libpciaccess/patches/patch-ac |  52 ++++++++++++++++++++++++++++-----
 3 files changed, 48 insertions(+), 11 deletions(-)

diffs (106 lines):

diff -r 2038825a4f6e -r 4502778175b6 sysutils/libpciaccess/Makefile
--- a/sysutils/libpciaccess/Makefile    Mon May 25 17:06:50 2009 +0000
+++ b/sysutils/libpciaccess/Makefile    Mon May 25 20:11:05 2009 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2009/05/18 19:09:01 hasso Exp $
+# $NetBSD: Makefile,v 1.4 2009/05/25 20:11:05 drochner Exp $
 #
 
 DISTNAME=      libpciaccess-0.10.6
+PKGREVISION=   1
 CATEGORIES=    sysutils x11
 MASTER_SITES=  ${MASTER_SITE_XORG:=lib/}
 EXTRACT_SUFX=  .tar.bz2
diff -r 2038825a4f6e -r 4502778175b6 sysutils/libpciaccess/distinfo
--- a/sysutils/libpciaccess/distinfo    Mon May 25 17:06:50 2009 +0000
+++ b/sysutils/libpciaccess/distinfo    Mon May 25 20:11:05 2009 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.4 2009/05/18 19:09:01 hasso Exp $
+$NetBSD: distinfo,v 1.5 2009/05/25 20:11:05 drochner Exp $
 
 SHA1 (libpciaccess-0.10.6.tar.bz2) = d8f2fc4d8a7e2934384476f0ae400e021ebc585b
 RMD160 (libpciaccess-0.10.6.tar.bz2) = 336c624dabee97475e75b358c1ff93fa8e26cba4
 Size (libpciaccess-0.10.6.tar.bz2) = 267671 bytes
 SHA1 (patch-aa) = baa96a3b85bb30d818e130c32bf5b295eefeb18f
-SHA1 (patch-ac) = cdb4b000b224432f5064e603926d4a541a73f895
+SHA1 (patch-ac) = d3157dee96bcd6e743a0f4a8b27b5e03a27cc79e
diff -r 2038825a4f6e -r 4502778175b6 sysutils/libpciaccess/patches/patch-ac
--- a/sysutils/libpciaccess/patches/patch-ac    Mon May 25 17:06:50 2009 +0000
+++ b/sysutils/libpciaccess/patches/patch-ac    Mon May 25 20:11:05 2009 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-ac,v 1.4 2009/05/18 19:09:01 hasso Exp $
+$NetBSD: patch-ac,v 1.5 2009/05/25 20:11:05 drochner Exp $
 
---- src/netbsd_pci.c.orig      2008-12-20 05:21:22 +0200
-+++ src/netbsd_pci.c   2009-05-18 08:38:14 +0300
+--- src/netbsd_pci.c.orig      2008-12-20 04:21:22.000000000 +0100
++++ src/netbsd_pci.c
 @@ -20,12 +20,15 @@
  #include <sys/mman.h>
  #include <sys/types.h>
@@ -34,20 +34,20 @@
  {
 -      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);
++      uint32_t rval;
  
 -      err = ioctl(pcifd, PCI_IOC_BDF_CFGREAD, &io);
 -      if (err)
 -              return (err);
--
++      if (pcibus_conf_read(pcifd, bus, dev, func, reg, &rval) == -1)
++              return (-1);
+ 
 -      *val = io.cfgreg.val;
 +      *val = rval;
  
@@ -238,3 +238,39 @@
                        return errno;
  
                offset += 4;
+@@ -222,6 +202,26 @@ pci_device_netbsd_write(struct pci_devic
+       return 0;
+ }
+ 
++static int
++pci_device_netbsd_read_rom(struct pci_device *device, void *buf)
++{
++      int fd, res, err;
++
++      fd = open("/dev/mem", O_RDONLY, 0);
++      if (fd < 0)
++              return errno;
++
++      lseek(fd, 0xc0000, SEEK_SET);
++      res = read(fd, buf, 64*1024);
++      if (res < 0) {
++              err = errno;
++              close(fd);
++              return err;
++      }
++      close(fd);
++      return 0;
++}
++
+ static void
+ pci_system_netbsd_destroy(void)
+ {
+@@ -312,7 +312,7 @@ pci_device_netbsd_probe(struct pci_devic
+ static const struct pci_system_methods netbsd_pci_methods = {
+       pci_system_netbsd_destroy,
+       NULL,
+-      NULL,
++      pci_device_netbsd_read_rom,
+       pci_device_netbsd_probe,
+       pci_device_netbsd_map_range,
+       pci_device_netbsd_unmap_range,



Home | Main Index | Thread Index | Old Index