162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright IBM Corp. 2020 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Author(s): 662306a36Sopenharmony_ci * Pierre Morel <pmorel@linux.ibm.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciint zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops); 1162306a36Sopenharmony_civoid zpci_bus_device_unregister(struct zpci_dev *zdev); 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciint zpci_bus_scan_bus(struct zpci_bus *zbus); 1462306a36Sopenharmony_civoid zpci_bus_scan_busses(void); 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciint zpci_bus_scan_device(struct zpci_dev *zdev); 1762306a36Sopenharmony_civoid zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error); 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_civoid zpci_release_device(struct kref *kref); 2062306a36Sopenharmony_cistatic inline void zpci_zdev_put(struct zpci_dev *zdev) 2162306a36Sopenharmony_ci{ 2262306a36Sopenharmony_ci if (zdev) 2362306a36Sopenharmony_ci kref_put(&zdev->kref, zpci_release_device); 2462306a36Sopenharmony_ci} 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistatic inline void zpci_zdev_get(struct zpci_dev *zdev) 2762306a36Sopenharmony_ci{ 2862306a36Sopenharmony_ci kref_get(&zdev->kref); 2962306a36Sopenharmony_ci} 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciint zpci_alloc_domain(int domain); 3262306a36Sopenharmony_civoid zpci_free_domain(int domain); 3362306a36Sopenharmony_ciint zpci_setup_bus_resources(struct zpci_dev *zdev); 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_cistatic inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus, 3662306a36Sopenharmony_ci unsigned int devfn) 3762306a36Sopenharmony_ci{ 3862306a36Sopenharmony_ci struct zpci_bus *zbus = bus->sysdata; 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn]; 4162306a36Sopenharmony_ci} 4262306a36Sopenharmony_ci 43