Module Name: xsrc Committed By: cegger Date: Sat Jan 22 15:18:57 UTC 2011
Modified Files: xsrc/external/mit/libpciaccess/dist/src: netbsd_pci.c Log Message: Implement pci_device_is_boot_vga() for NetBSD using new WSDISPLAYIO_GET_BUSID ioctl. This lets Xorg start on machines with more than one PCI display device instead of exiting with 'Primary device is not PCI'. First discussed with macallan@ then public on tech-kern@ and tech-x11@. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.9 --- xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.8 Wed Jan 12 19:03:50 2011 +++ xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c Sat Jan 22 15:18:57 2011 @@ -40,6 +40,7 @@ #include <pci.h> +#include <dev/wscons/wsconsio.h> #include "pciaccess.h" #include "pciaccess_private.h" @@ -247,6 +248,43 @@ return 0; } +static int +pci_device_netbsd_boot_vga(struct pci_device *dev) +{ + int ret; + struct wsdisplayio_bus_id busid; + int fd; + + fd = open("/dev/ttyE0", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "failed to open /dev/ttyE0: %s\n", + strerror(errno)); + return 0; + } + + ret = ioctl(fd, WSDISPLAYIO_GET_BUSID, &busid); + close(fd); + if (ret == -1) { + fprintf(stderr, "ioctl WSDISPLAYIO_GET_BUSID failed: %s\n", + strerror(errno)); + return 0; + } + + if (busid.bus_type != WSDISPLAYIO_BUS_PCI) + return 0; + + if (busid.ubus.pci.domain != dev->domain) + return 0; + if (busid.ubus.pci.bus != dev->bus) + return 0; + if (busid.ubus.pci.device != dev->dev) + return 0; + if (busid.ubus.pci.function != dev->func) + return 0; + + return 1; +} + static void pci_system_netbsd_destroy(void) { @@ -479,7 +517,8 @@ .unmap_range = pci_device_netbsd_unmap_range, .read = pci_device_netbsd_read, .write = pci_device_netbsd_write, - .fill_capabilities = pci_fill_capabilities_generic + .fill_capabilities = pci_fill_capabilities_generic, + .boot_vga = pci_device_netbsd_boot_vga, }; int