pcieport_if.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * File: pcieport_if.h
  3. * Purpose: PCI Express Port Bus Driver's IF Data Structure
  4. *
  5. * Copyright (C) 2004 Intel
  6. * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
  7. */
  8. #ifndef _PCIEPORT_IF_H_
  9. #define _PCIEPORT_IF_H_
  10. /* Port Type */
  11. #define PCIE_ANY_PORT (~0)
  12. /* Service Type */
  13. #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
  14. #define PCIE_PORT_SERVICE_PME (1 << PCIE_PORT_SERVICE_PME_SHIFT)
  15. #define PCIE_PORT_SERVICE_AER_SHIFT 1 /* Advanced Error Reporting */
  16. #define PCIE_PORT_SERVICE_AER (1 << PCIE_PORT_SERVICE_AER_SHIFT)
  17. #define PCIE_PORT_SERVICE_HP_SHIFT 2 /* Native Hotplug */
  18. #define PCIE_PORT_SERVICE_HP (1 << PCIE_PORT_SERVICE_HP_SHIFT)
  19. #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
  20. #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
  21. struct pcie_device {
  22. int irq; /* Service IRQ/MSI/MSI-X Vector */
  23. struct pci_dev *port; /* Root/Upstream/Downstream Port */
  24. u32 service; /* Port service this device represents */
  25. void *priv_data; /* Service Private Data */
  26. struct device device; /* Generic Device Interface */
  27. };
  28. #define to_pcie_device(d) container_of(d, struct pcie_device, device)
  29. static inline void set_service_data(struct pcie_device *dev, void *data)
  30. {
  31. dev->priv_data = data;
  32. }
  33. static inline void* get_service_data(struct pcie_device *dev)
  34. {
  35. return dev->priv_data;
  36. }
  37. struct pcie_port_service_driver {
  38. const char *name;
  39. int (*probe) (struct pcie_device *dev);
  40. void (*remove) (struct pcie_device *dev);
  41. int (*suspend) (struct pcie_device *dev);
  42. int (*resume) (struct pcie_device *dev);
  43. /* Service Error Recovery Handler */
  44. const struct pci_error_handlers *err_handler;
  45. /* Link Reset Capability - AER service driver specific */
  46. pci_ers_result_t (*reset_link) (struct pci_dev *dev);
  47. int port_type; /* Type of the port this driver can handle */
  48. u32 service; /* Port service this device represents */
  49. struct device_driver driver;
  50. };
  51. #define to_service_driver(d) \
  52. container_of(d, struct pcie_port_service_driver, driver)
  53. int pcie_port_service_register(struct pcie_port_service_driver *new);
  54. void pcie_port_service_unregister(struct pcie_port_service_driver *new);
  55. #endif /* _PCIEPORT_IF_H_ */