xref: /openbmc/linux/arch/s390/pci/pci_bus.h (revision a701d28e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright IBM Corp. 2020
4  *
5  * Author(s):
6  *   Pierre Morel <pmorel@linux.ibm.com>
7  *
8  */
9 
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 
13 void zpci_release_device(struct kref *kref);
14 static inline void zpci_zdev_put(struct zpci_dev *zdev)
15 {
16 	kref_put(&zdev->kref, zpci_release_device);
17 }
18 
19 int zpci_alloc_domain(int domain);
20 void zpci_free_domain(int domain);
21 int zpci_setup_bus_resources(struct zpci_dev *zdev,
22 			     struct list_head *resources);
23 
24 static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
25 					       unsigned int devfn)
26 {
27 	struct zpci_bus *zbus = bus->sysdata;
28 
29 	return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
30 }
31 
32