1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright IBM Corp. 2020
6 * Pierre Morel <pmorel@linux.ibm.com>
10 int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops);
11 void zpci_bus_device_unregister(struct zpci_dev *zdev);
12 int zpci_bus_init(void);
14 void zpci_release_device(struct kref *kref);
15 static inline void zpci_zdev_put(struct zpci_dev *zdev)
17 kref_put(&zdev->kref, zpci_release_device);
20 int zpci_alloc_domain(int domain);
21 void zpci_free_domain(int domain);
22 int zpci_setup_bus_resources(struct zpci_dev *zdev,
23 struct list_head *resources);
25 static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
28 struct zpci_bus *zbus = bus->sysdata;
30 return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
34 static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn)
37 pci_lock_rescan_remove();
38 /* Linux' vfid's start at 0 vfn at 1 */
39 pci_iov_remove_virtfn(pdev->physfn, vfn - 1);
40 pci_unlock_rescan_remove();
42 #else /* CONFIG_PCI_IOV */
43 static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn) {}
44 #endif /* CONFIG_PCI_IOV */