X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Faix-device.c;h=028d92ae312503582d37efb72d486b225e2cb16e;hb=7d23054d18402b1891343f090d3cd37d7e83c82f;hp=2febd7973092b9e9e412ea2006d3203186475e9d;hpb=cb6ee324dd157dc5dec68eab488e7c829e92e2a2;p=pciutils.git diff --git a/lib/aix-device.c b/lib/aix-device.c index 2febd79..028d92a 100644 --- a/lib/aix-device.c +++ b/lib/aix-device.c @@ -3,7 +3,9 @@ * * Copyright (c) 1999 Jari Kirma * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ /* @@ -60,9 +62,10 @@ aix_find_bus(struct pci_access *a, int bus_number) } static int -aix_bus_open(struct pci_access *a, int bus_number) +aix_bus_open(struct pci_dev *d) { - aix_pci_bus *bp = aix_find_bus(a, bus_number); + struct pci_access *a = d->access; + aix_pci_bus *bp = aix_find_bus(a, d->bus); if (bp->bus_fd < 0) { @@ -72,9 +75,7 @@ aix_bus_open(struct pci_access *a, int bus_number) snprintf(devbuf, sizeof (devbuf), "/dev/%s", bp->bus_name); bp->bus_fd = open(devbuf, mode, 0); if (bp->bus_fd < 0) - { - a->error("aix_open_bus: %s open failed", devbuf); - } + a->error("aix_open_bus: %s open failed", devbuf); } return bp->bus_fd; @@ -207,7 +208,7 @@ aix_scan(struct pci_access *a) bus_number = pci_buses[i].bus_number; if (!busmap[bus_number]) { - pci_generic_scan_bus(a, busmap, bus_number); + pci_generic_scan_bus(a, busmap, 0, bus_number); } } } @@ -218,10 +219,10 @@ aix_read(struct pci_dev *d, int pos, byte *buf, int len) struct mdio mdio; int fd; - if (pos + len > 256) + if (d->domain || pos + len > 256) return 0; - fd = aix_bus_open(d->access, d->bus); + fd = aix_bus_open(d); mdio.md_addr = (ulong) pos; mdio.md_size = len; mdio.md_incr = MV_BYTE; @@ -240,10 +241,10 @@ aix_write(struct pci_dev *d, int pos, byte *buf, int len) struct mdio mdio; int fd; - if (pos + len > 256) + if (d->domain || pos + len > 256) return 0; - fd = aix_bus_open(d->access, d->bus); + fd = aix_bus_open(d); mdio.md_addr = (ulong) pos; mdio.md_size = len; mdio.md_incr = MV_BYTE; @@ -259,7 +260,8 @@ aix_write(struct pci_dev *d, int pos, byte *buf, int len) } struct pci_methods pm_aix_device = { - "AIX-device", + "aix-device", + "AIX /dev/pci[0-n]", NULL, aix_detect, aix_init, @@ -268,6 +270,7 @@ struct pci_methods pm_aix_device = { pci_generic_fill_info, aix_read, aix_write, + NULL, /* read_vpd */ NULL, /* dev_init */ NULL /* dev_cleanup */ };