X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffbsd-device.c;h=604c8f02189a02fc814171989ddfd9ccdc4d7bbd;hb=4c2b4b1bfa348ea22a22f4ca271bc13096ab3e78;hp=6bb5fddedf2c6f4a9cb7f0b76ec4903668ed5315;hpb=0f3898a44ad32bec37543a03ed8021f5c880e3c1;p=pciutils.git diff --git a/lib/fbsd-device.c b/lib/fbsd-device.c index 6bb5fdd..604c8f0 100644 --- a/lib/fbsd-device.c +++ b/lib/fbsd-device.c @@ -159,8 +159,8 @@ fbsd_scan(struct pci_access *a) free(matches); } -static int -fbsd_fill_info(struct pci_dev *d, int flags) +static void +fbsd_fill_info(struct pci_dev *d, unsigned int flags) { struct pci_conf_io conf; struct pci_bar_io bar; @@ -195,21 +195,19 @@ fbsd_fill_info(struct pci_dev *d, int flags) if (ioctl(d->access->fd, PCIOCGETCONF, &conf) < 0) { - if (errno == ENODEV) - return 0; - d->access->error("fbsd_fill_info: ioctl(PCIOCGETCONF) failed: %s", strerror(errno)); + if (errno != ENODEV) + d->access->error("fbsd_fill_info: ioctl(PCIOCGETCONF) failed: %s", strerror(errno)); + return; } - if (flags & PCI_FILL_IDENT) + if (want_fill(d, flags, PCI_FILL_IDENT)) { d->vendor_id = match.pc_vendor; d->device_id = match.pc_device; } - if (flags & PCI_FILL_CLASS) - { - d->device_class = (match.pc_class << 8) | match.pc_subclass; - } - if (flags & (PCI_FILL_BASES | PCI_FILL_SIZES)) + if (want_fill(d, flags, PCI_FILL_CLASS)) + d->device_class = (match.pc_class << 8) | match.pc_subclass; + if (want_fill(d, flags, PCI_FILL_BASES | PCI_FILL_SIZES)) { d->rom_base_addr = 0; d->rom_size = 0; @@ -226,7 +224,7 @@ fbsd_fill_info(struct pci_dev *d, int flags) if (ioctl(d->access->fd, PCIOCGETBAR, &bar) < 0) { if (errno == ENODEV) - return 0; + return; if (errno == EINVAL) { d->base_addr[i] = 0; @@ -242,9 +240,6 @@ fbsd_fill_info(struct pci_dev *d, int flags) } } } - - return flags & (PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_BASES | - PCI_FILL_SIZES); } static int @@ -266,6 +261,9 @@ fbsd_read(struct pci_dev *d, int pos, byte *buf, int len) #if __FreeBSD_version >= 700053 || defined(__DragonFly__) pi.pi_sel.pc_domain = d->domain; +#else + if (d->domain) + return 0; #endif pi.pi_sel.pc_bus = d->bus; pi.pi_sel.pc_dev = d->dev; @@ -315,6 +313,9 @@ fbsd_write(struct pci_dev *d, int pos, byte *buf, int len) #if __FreeBSD_version >= 700053 || defined(__DragonFly__) pi.pi_sel.pc_domain = d->domain; +#else + if (d->domain) + return 0; #endif pi.pi_sel.pc_bus = d->bus; pi.pi_sel.pc_dev = d->dev;