105bc1be6SPierre Morel /* SPDX-License-Identifier: GPL-2.0 */ 205bc1be6SPierre Morel /* 305bc1be6SPierre Morel * Copyright IBM Corp. 2020 405bc1be6SPierre Morel * 505bc1be6SPierre Morel * Author(s): 605bc1be6SPierre Morel * Pierre Morel <pmorel@linux.ibm.com> 705bc1be6SPierre Morel * 805bc1be6SPierre Morel */ 905bc1be6SPierre Morel 1005bc1be6SPierre Morel int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops); 1105bc1be6SPierre Morel void zpci_bus_device_unregister(struct zpci_dev *zdev); 1205bc1be6SPierre Morel 13a50297cfSNiklas Schnelle int zpci_bus_scan_bus(struct zpci_bus *zbus); 14*14c87ba8SNiklas Schnelle void zpci_bus_scan_busses(void); 15a50297cfSNiklas Schnelle 16faf29a4dSNiklas Schnelle int zpci_bus_scan_device(struct zpci_dev *zdev); 1795b3a8b4SNiklas Schnelle void zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error); 1895b3a8b4SNiklas Schnelle 1905bc1be6SPierre Morel void zpci_release_device(struct kref *kref); 2005bc1be6SPierre Morel static inline void zpci_zdev_put(struct zpci_dev *zdev) 2105bc1be6SPierre Morel { 2205bc1be6SPierre Morel kref_put(&zdev->kref, zpci_release_device); 2305bc1be6SPierre Morel } 2405bc1be6SPierre Morel 2505bc1be6SPierre Morel int zpci_alloc_domain(int domain); 2605bc1be6SPierre Morel void zpci_free_domain(int domain); 2705bc1be6SPierre Morel int zpci_setup_bus_resources(struct zpci_dev *zdev, 2805bc1be6SPierre Morel struct list_head *resources); 2905bc1be6SPierre Morel 3044510d6fSPierre Morel static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus, 3144510d6fSPierre Morel unsigned int devfn) 3205bc1be6SPierre Morel { 3305bc1be6SPierre Morel struct zpci_bus *zbus = bus->sysdata; 3405bc1be6SPierre Morel 3544510d6fSPierre Morel return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn]; 3605bc1be6SPierre Morel } 37b97bf44fSNiklas Schnelle 38