pci_bus.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright IBM Corp. 2020
  4. *
  5. * Author(s):
  6. * Pierre Morel <[email protected]>
  7. *
  8. */
  9. int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops);
  10. void zpci_bus_device_unregister(struct zpci_dev *zdev);
  11. int zpci_bus_scan_bus(struct zpci_bus *zbus);
  12. void zpci_bus_scan_busses(void);
  13. int zpci_bus_scan_device(struct zpci_dev *zdev);
  14. void zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error);
  15. void zpci_release_device(struct kref *kref);
  16. static inline void zpci_zdev_put(struct zpci_dev *zdev)
  17. {
  18. if (zdev)
  19. kref_put(&zdev->kref, zpci_release_device);
  20. }
  21. static inline void zpci_zdev_get(struct zpci_dev *zdev)
  22. {
  23. kref_get(&zdev->kref);
  24. }
  25. int zpci_alloc_domain(int domain);
  26. void zpci_free_domain(int domain);
  27. int zpci_setup_bus_resources(struct zpci_dev *zdev);
  28. static inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus,
  29. unsigned int devfn)
  30. {
  31. struct zpci_bus *zbus = bus->sysdata;
  32. return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
  33. }