File Index
Files and directories
Sign in
FILE

pci_bus.h

File preview with syntax highlighting.

linux-6.19.14/arch/s390/pci/pci_bus.h C
 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#ifndef __S390_PCI_BUS_H
10#define __S390_PCI_BUS_H
11
12#include <linux/pci.h>
13
14int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops);
15void zpci_bus_device_unregister(struct zpci_dev *zdev);
16
17int zpci_bus_scan_bus(struct zpci_bus *zbus);
18void zpci_bus_get_next(struct zpci_bus **pos);
19
20/**
21 * zpci_bus_for_each - iterate over all the registered zbus objects
22 * @pos:	a struct zpci_bus * as cursor
23 *
24 * Acquires and releases references as the cursor iterates over the registered
25 * objects. Is tolerant against concurrent removals of objects.
26 *
27 * Context: Process context. May sleep.
28 */
29#define zpci_bus_for_each(pos)					     \
30	for ((pos) = NULL, zpci_bus_get_next(&(pos)); (pos) != NULL; \
31	     zpci_bus_get_next(&(pos)))
32
33int zpci_bus_scan_device(struct zpci_dev *zdev);
34void zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error);
35
36void zpci_release_device(struct kref *kref);
37
38void zpci_zdev_put(struct zpci_dev *zdev);
39
40static inline void zpci_zdev_get(struct zpci_dev *zdev)
41{
42	kref_get(&zdev->kref);
43}
44
45int zpci_alloc_domain(int domain);
46void zpci_free_domain(int domain);
47int zpci_setup_bus_resources(struct zpci_dev *zdev);
48
49static inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus,
50					     unsigned int devfn)
51{
52	struct zpci_bus *zbus = bus->sysdata;
53
54	return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
55}
56
57#endif /* __S390_PCI_BUS_H */
~/ Read-only file preview.