Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / pcieport_if.h
blobb69769dbf6597ada1960403ceaa370a75a6303d0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * File: pcieport_if.h
4 * Purpose: PCI Express Port Bus Driver's IF Data Structure
6 * Copyright (C) 2004 Intel
7 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
8 */
10 #ifndef _PCIEPORT_IF_H_
11 #define _PCIEPORT_IF_H_
13 /* Port Type */
14 #define PCIE_ANY_PORT (~0)
16 /* Service Type */
17 #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
18 #define PCIE_PORT_SERVICE_PME (1 << PCIE_PORT_SERVICE_PME_SHIFT)
19 #define PCIE_PORT_SERVICE_AER_SHIFT 1 /* Advanced Error Reporting */
20 #define PCIE_PORT_SERVICE_AER (1 << PCIE_PORT_SERVICE_AER_SHIFT)
21 #define PCIE_PORT_SERVICE_HP_SHIFT 2 /* Native Hotplug */
22 #define PCIE_PORT_SERVICE_HP (1 << PCIE_PORT_SERVICE_HP_SHIFT)
23 #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
24 #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
25 #define PCIE_PORT_SERVICE_DPC_SHIFT 4 /* Downstream Port Containment */
26 #define PCIE_PORT_SERVICE_DPC (1 << PCIE_PORT_SERVICE_DPC_SHIFT)
28 struct pcie_device {
29 int irq; /* Service IRQ/MSI/MSI-X Vector */
30 struct pci_dev *port; /* Root/Upstream/Downstream Port */
31 u32 service; /* Port service this device represents */
32 void *priv_data; /* Service Private Data */
33 struct device device; /* Generic Device Interface */
35 #define to_pcie_device(d) container_of(d, struct pcie_device, device)
37 static inline void set_service_data(struct pcie_device *dev, void *data)
39 dev->priv_data = data;
42 static inline void *get_service_data(struct pcie_device *dev)
44 return dev->priv_data;
47 struct pcie_port_service_driver {
48 const char *name;
49 int (*probe) (struct pcie_device *dev);
50 void (*remove) (struct pcie_device *dev);
51 int (*suspend) (struct pcie_device *dev);
52 int (*resume) (struct pcie_device *dev);
54 /* Device driver may resume normal operations */
55 void (*error_resume)(struct pci_dev *dev);
57 /* Link Reset Capability - AER service driver specific */
58 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
60 int port_type; /* Type of the port this driver can handle */
61 u32 service; /* Port service this device represents */
63 struct device_driver driver;
65 #define to_service_driver(d) \
66 container_of(d, struct pcie_port_service_driver, driver)
68 int pcie_port_service_register(struct pcie_port_service_driver *new);
69 void pcie_port_service_unregister(struct pcie_port_service_driver *new);
71 #endif /* _PCIEPORT_IF_H_ */