multibus_pci.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) 2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #include "hif.h"
  27. #include "hif_main.h"
  28. #include "multibus.h"
  29. #include "pci_api.h"
  30. #include "hif_io32.h"
  31. #include "dummy.h"
  32. #include "ce_api.h"
  33. /**
  34. * hif_initialize_pci_ops() - initialize the pci ops
  35. * @bus_ops: hif_bus_ops table pointer to initialize
  36. *
  37. * Return: QDF_STATUS_SUCCESS
  38. */
  39. QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
  40. {
  41. struct hif_bus_ops *bus_ops = &hif_sc->bus_ops;
  42. bus_ops->hif_bus_open = &hif_pci_open;
  43. bus_ops->hif_bus_close = &hif_pci_close;
  44. bus_ops->hif_bus_prevent_linkdown = &hif_pci_prevent_linkdown;
  45. bus_ops->hif_reset_soc = &hif_pci_reset_soc;
  46. bus_ops->hif_bus_suspend = &hif_pci_bus_suspend;
  47. bus_ops->hif_bus_resume = &hif_pci_bus_resume;
  48. /* do not put the target to sleep for epping or maxperf mode */
  49. if (CONFIG_ATH_PCIE_MAX_PERF == 0 &&
  50. !QDF_IS_EPPING_ENABLED(hif_get_conparam(hif_sc)))
  51. bus_ops->hif_target_sleep_state_adjust =
  52. &hif_pci_target_sleep_state_adjust;
  53. else
  54. bus_ops->hif_target_sleep_state_adjust =
  55. &hif_dummy_target_sleep_state_adjust;
  56. bus_ops->hif_disable_isr = &hif_pci_disable_isr;
  57. bus_ops->hif_nointrs = &hif_pci_nointrs;
  58. bus_ops->hif_enable_bus = &hif_pci_enable_bus;
  59. bus_ops->hif_disable_bus = &hif_pci_disable_bus;
  60. bus_ops->hif_bus_configure = &hif_pci_bus_configure;
  61. bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
  62. bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
  63. bus_ops->hif_claim_device = &hif_dummy_claim_device;
  64. bus_ops->hif_shutdown_device = &hif_ce_stop;
  65. bus_ops->hif_stop = &hif_ce_stop;
  66. bus_ops->hif_cancel_deferred_target_sleep =
  67. &hif_pci_cancel_deferred_target_sleep;
  68. bus_ops->hif_irq_disable = &hif_pci_irq_disable;
  69. bus_ops->hif_irq_enable = &hif_pci_irq_enable;
  70. bus_ops->hif_dump_registers = &hif_pci_dump_registers;
  71. bus_ops->hif_dump_target_memory = &hif_ce_dump_target_memory;
  72. bus_ops->hif_ipa_get_ce_resource = &hif_ce_ipa_get_ce_resource;
  73. bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call;
  74. bus_ops->hif_enable_power_management =
  75. &hif_pci_enable_power_management;
  76. bus_ops->hif_disable_power_management =
  77. &hif_pci_disable_power_management;
  78. bus_ops->hif_display_stats =
  79. &hif_pci_display_stats;
  80. bus_ops->hif_clear_stats =
  81. &hif_pci_clear_stats;
  82. return QDF_STATUS_SUCCESS;
  83. }
  84. /**
  85. * hif_pci_get_context_size() - return the size of the pci context
  86. *
  87. * Return the size of the context. (0 for invalid bus)
  88. */
  89. int hif_pci_get_context_size(void)
  90. {
  91. return sizeof(struct hif_pci_softc);
  92. }