Module Name: xsrc Committed By: macallan Date: Thu Nov 18 04:47:01 UTC 2010
Modified Files: xsrc/external/mit/libpciaccess/dist/src: netbsd_pci.c Log Message: when trying to map a ROM go through the appropriate /dev/pci* instance instead of opening /dev/mem With this Xorg should be able to read graphics card ROMs on all ports. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c diff -u xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.6 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.7 --- xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.6 Tue Jan 12 03:05:31 2010 +++ xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c Thu Nov 18 04:47:00 2010 @@ -388,7 +388,7 @@ pciaddr_t rom_base; size_t rom_size; uint32_t bios_val, command_val; - int pci_rom, memfd; + int pci_rom; if (((priv->base.device_class >> 16) & 0xff) != PCI_CLASS_DISPLAY || ((priv->base.device_class >> 8) & 0xff) != PCI_SUBCLASS_DISPLAY_VGA) @@ -434,23 +434,19 @@ } } - fprintf(stderr, "Using rom_base = 0x%lx (pci_rom=%d)\n", (long)rom_base, - pci_rom); - memfd = open("/dev/mem", O_RDONLY); - if (memfd == -1) - return errno; + fprintf(stderr, "Using rom_base = 0x%lx 0x%lx (pci_rom=%d)\n", + (long)rom_base, (long)rom_size, pci_rom); - bios = mmap(NULL, rom_size, PROT_READ, MAP_SHARED, memfd, (off_t)rom_base); + bios = mmap(NULL, rom_size, PROT_READ, MAP_SHARED, buses[dev->domain].fd, + (off_t)rom_base); if (bios == MAP_FAILED) { int serrno = errno; - close(memfd); return serrno; } memcpy(buffer, bios, rom_size); munmap(bios, rom_size); - close(memfd); if (pci_rom) { if ((command_val & PCI_COMMAND_MEM_ENABLE) == 0) {