portdrv.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * File: portdrv.h
  3. * Purpose: PCI Express Port Bus Driver's Internal Data Structures
  4. *
  5. * Copyright (C) 2004 Intel
  6. * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
  7. */
  8. #ifndef _PORTDRV_H_
  9. #define _PORTDRV_H_
  10. #include <linux/compiler.h>
  11. #define PCIE_PORT_DEVICE_MAXSERVICES 4
  12. /*
  13. * According to the PCI Express Base Specification 2.0, the indices of
  14. * the MSI-X table entires used by port services must not exceed 31
  15. */
  16. #define PCIE_PORT_MAX_MSIX_ENTRIES 32
  17. #define get_descriptor_id(type, service) (((type - 4) << 4) | service)
  18. extern bool pcie_ports_disabled;
  19. extern bool pcie_ports_auto;
  20. extern struct bus_type pcie_port_bus_type;
  21. extern int pcie_port_device_register(struct pci_dev *dev);
  22. #ifdef CONFIG_PM
  23. extern int pcie_port_device_suspend(struct device *dev);
  24. extern int pcie_port_device_resume(struct device *dev);
  25. #endif
  26. extern void pcie_port_device_remove(struct pci_dev *dev);
  27. extern int __must_check pcie_port_bus_register(void);
  28. extern void pcie_port_bus_unregister(void);
  29. struct pci_dev;
  30. #ifdef CONFIG_PCIE_PME
  31. extern bool pcie_pme_msi_disabled;
  32. static inline void pcie_pme_disable_msi(void)
  33. {
  34. pcie_pme_msi_disabled = true;
  35. }
  36. static inline bool pcie_pme_no_msi(void)
  37. {
  38. return pcie_pme_msi_disabled;
  39. }
  40. extern void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable);
  41. #else /* !CONFIG_PCIE_PME */
  42. static inline void pcie_pme_disable_msi(void) {}
  43. static inline bool pcie_pme_no_msi(void) { return false; }
  44. static inline void pcie_pme_interrupt_enable(struct pci_dev *dev, bool en) {}
  45. #endif /* !CONFIG_PCIE_PME */
  46. #ifdef CONFIG_ACPI
  47. extern int pcie_port_acpi_setup(struct pci_dev *port, int *mask);
  48. static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask)
  49. {
  50. return pcie_port_acpi_setup(port, mask);
  51. }
  52. #else /* !CONFIG_ACPI */
  53. static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask)
  54. {
  55. return 0;
  56. }
  57. #endif /* !CONFIG_ACPI */
  58. #endif /* _PORTDRV_H_ */