diff options
author | drochner <drochner@pkgsrc.org> | 2009-05-25 20:11:05 +0000 |
---|---|---|
committer | drochner <drochner@pkgsrc.org> | 2009-05-25 20:11:05 +0000 |
commit | 4c717b7dc45e826d5da5672a017a2fe69eaa062b (patch) | |
tree | 1db53b4e05b932ba455f1de68d9431c23caa1550 /sysutils | |
parent | 5983e2c451213907fe73cbea371cc90fd8af6615 (diff) | |
download | pkgsrc-4c717b7dc45e826d5da5672a017a2fe69eaa062b.tar.gz |
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 (limited to 'sysutils')
-rw-r--r-- | sysutils/libpciaccess/Makefile | 3 | ||||
-rw-r--r-- | sysutils/libpciaccess/distinfo | 4 | ||||
-rw-r--r-- | sysutils/libpciaccess/patches/patch-ac | 52 |
3 files changed, 48 insertions, 11 deletions
diff --git a/sysutils/libpciaccess/Makefile b/sysutils/libpciaccess/Makefile index 739f827f5ef..7875f72263e 100644 --- a/sysutils/libpciaccess/Makefile +++ b/sysutils/libpciaccess/Makefile @@ -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 --git a/sysutils/libpciaccess/distinfo b/sysutils/libpciaccess/distinfo index 48c611b2551..b457f92b212 100644 --- a/sysutils/libpciaccess/distinfo +++ b/sysutils/libpciaccess/distinfo @@ -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 --git a/sysutils/libpciaccess/patches/patch-ac b/sysutils/libpciaccess/patches/patch-ac index bcb77856f14..8472348d84e 100644 --- a/sysutils/libpciaccess/patches/patch-ac +++ b/sysutils/libpciaccess/patches/patch-ac @@ -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 @@ $NetBSD: patch-ac,v 1.4 2009/05/18 19:09:01 hasso Exp $ { - 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 @@ $NetBSD: patch-ac,v 1.4 2009/05/18 19:09:01 hasso Exp $ 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, |