pci_api.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _PCI_API_H_
  19. #define _PCI_API_H_
  20. struct hif_exec_context;
  21. QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx,
  22. enum qdf_bus_type bus_type);
  23. void hif_pci_close(struct hif_softc *hif_ctx);
  24. void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag);
  25. void hif_pci_reset_soc(struct hif_softc *ol_sc);
  26. int hif_pci_bus_suspend(struct hif_softc *scn);
  27. int hif_pci_bus_suspend_noirq(struct hif_softc *scn);
  28. int hif_pci_bus_resume(struct hif_softc *scn);
  29. int hif_pci_bus_resume_noirq(struct hif_softc *scn);
  30. int hif_pci_target_sleep_state_adjust(struct hif_softc *scn,
  31. bool sleep_ok, bool wait_for_it);
  32. void hif_pci_disable_isr(struct hif_softc *scn);
  33. void hif_pci_nointrs(struct hif_softc *scn);
  34. QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn,
  35. struct device *dev, void *bdev,
  36. const struct hif_bus_id *bid,
  37. enum hif_enable_type type);
  38. void hif_pci_disable_bus(struct hif_softc *scn);
  39. #ifdef FEATURE_RUNTIME_PM
  40. struct hif_runtime_pm_ctx *hif_pci_get_rpm_ctx(struct hif_softc *hif_sc);
  41. struct device *hif_pci_get_dev(struct hif_softc *hif_sc);
  42. #endif
  43. int hif_pci_bus_configure(struct hif_softc *scn);
  44. void hif_pci_irq_disable(struct hif_softc *scn, int ce_id);
  45. void hif_pci_irq_enable(struct hif_softc *scn, int ce_id);
  46. int hif_pci_dump_registers(struct hif_softc *scn);
  47. void hif_pci_enable_power_management(struct hif_softc *hif_ctx,
  48. bool is_packet_log_enabled);
  49. void hif_pci_disable_power_management(struct hif_softc *hif_ctx);
  50. int hif_pci_configure_grp_irq(struct hif_softc *scn,
  51. struct hif_exec_context *exec);
  52. /**
  53. * hif_pci_reg_read32() - Read register in 32bits
  54. * @hif_sc: PCIe control struct
  55. * @offset: The register offset
  56. *
  57. * This function will read register in 32bits
  58. *
  59. * Return: return value for register with specified offset
  60. */
  61. uint32_t hif_pci_reg_read32(struct hif_softc *hif_sc,
  62. uint32_t offset);
  63. /**
  64. * hif_pci_reg_write32() - Write register in 32bits
  65. * @hif_sc: PCIe control struct
  66. * @offset: The register offset
  67. * @value: The value need to be written
  68. *
  69. * This function will write register in 32bits
  70. *
  71. * Return: None
  72. */
  73. void hif_pci_reg_write32(struct hif_softc *hif_sc,
  74. uint32_t offset,
  75. uint32_t value);
  76. void hif_pci_display_stats(struct hif_softc *hif_ctx);
  77. void hif_pci_clear_stats(struct hif_softc *hif_ctx);
  78. int hif_pci_legacy_map_ce_to_irq(struct hif_softc *scn, int ce_id);
  79. bool hif_pci_needs_bmi(struct hif_softc *scn);
  80. const char *hif_pci_get_irq_name(int irq_no);
  81. /** hif_pci_config_irq_affinity() - Set the IRQ affinity
  82. * @scn: hif context
  83. *
  84. * Set IRQ affinity hint for WLAN IRQs to gold cores only for
  85. * defconfig builds.
  86. *
  87. * Return: None
  88. */
  89. void hif_pci_config_irq_affinity(struct hif_softc *scn);
  90. int hif_ce_msi_configure_irq_by_ceid(struct hif_softc *scn, int ce_id);
  91. #endif /* _PCI_API_H_ */