1 /*
2 * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 #include "hif.h"
19 #include "hif_main.h"
20 #include "multibus.h"
21 #include "ipci_api.h"
22 #include "hif_io32.h"
23 #include "dummy.h"
24 #include "ce_api.h"
25
26 /**
27 * hif_initialize_ipci_ops() - initialize the pci ops
28 * @hif_sc: hif_context
29 *
30 * Return: QDF_STATUS_SUCCESS
31 */
hif_initialize_ipci_ops(struct hif_softc * hif_sc)32 QDF_STATUS hif_initialize_ipci_ops(struct hif_softc *hif_sc)
33 {
34 struct hif_bus_ops *bus_ops = &hif_sc->bus_ops;
35
36 bus_ops->hif_bus_open = &hif_ipci_open;
37 bus_ops->hif_bus_close = &hif_ipci_close;
38 bus_ops->hif_bus_prevent_linkdown = &hif_ipci_prevent_linkdown;
39 bus_ops->hif_reset_soc = &hif_dummy_reset_soc;
40 bus_ops->hif_bus_suspend = &hif_ipci_bus_suspend;
41 bus_ops->hif_bus_resume = &hif_ipci_bus_resume;
42 bus_ops->hif_bus_suspend_noirq = &hif_ipci_bus_suspend_noirq;
43 bus_ops->hif_bus_resume_noirq = &hif_ipci_bus_resume_noirq;
44 bus_ops->hif_target_sleep_state_adjust =
45 &hif_dummy_target_sleep_state_adjust;
46 bus_ops->hif_disable_isr = &hif_ipci_disable_isr;
47 bus_ops->hif_nointrs = &hif_ipci_nointrs;
48 bus_ops->hif_enable_bus = &hif_ipci_enable_bus;
49 bus_ops->hif_disable_bus = &hif_ipci_disable_bus;
50 bus_ops->hif_bus_configure = &hif_ipci_bus_configure;
51 bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
52 bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
53 bus_ops->hif_claim_device = &hif_dummy_claim_device;
54 bus_ops->hif_shutdown_device = &hif_ce_stop;
55 bus_ops->hif_stop = &hif_ce_stop;
56 bus_ops->hif_cancel_deferred_target_sleep =
57 &hif_dummy_cancel_deferred_target_sleep;
58 bus_ops->hif_irq_disable = &hif_dummy_irq_disable;
59 bus_ops->hif_irq_enable = &hif_dummy_irq_enable;
60 bus_ops->hif_dump_registers = &hif_ipci_dump_registers;
61 bus_ops->hif_dump_target_memory = &hif_ce_dump_target_memory;
62 bus_ops->hif_reg_read32 = &hif_dummy_bus_reg_read32;
63 bus_ops->hif_reg_write32 = &hif_dummy_bus_reg_write32;
64 bus_ops->hif_ipa_get_ce_resource = &hif_ce_ipa_get_ce_resource;
65 bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call;
66 bus_ops->hif_enable_power_management =
67 &hif_ipci_enable_power_management;
68 bus_ops->hif_disable_power_management =
69 &hif_ipci_disable_power_management;
70 bus_ops->hif_grp_irq_configure = &hif_ipci_configure_grp_irq;
71 bus_ops->hif_grp_irq_deconfigure = &hif_ipci_deconfigure_grp_irq;
72 bus_ops->hif_display_stats =
73 &hif_ipci_display_stats;
74 bus_ops->hif_clear_stats =
75 &hif_ipci_clear_stats;
76 bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary;
77 bus_ops->hif_needs_bmi = &hif_ipci_needs_bmi;
78 #ifdef HIF_CPU_PERF_AFFINE_MASK
79 bus_ops->hif_config_irq_affinity =
80 &hif_ipci_config_irq_affinity;
81 #else
82 bus_ops->hif_config_irq_affinity =
83 &hif_dummy_config_irq_affinity;
84 #endif
85 bus_ops->hif_config_irq_by_ceid = &hif_dummy_config_irq_by_ceid;
86 bus_ops->hif_config_irq_clear_cpu_affinity =
87 &hif_ipci_config_irq_clear_cpu_affinity;
88 bus_ops->hif_log_bus_info = &hif_dummy_log_bus_info;
89 #ifndef QCA_WIFI_WCN6450
90 bus_ops->hif_enable_grp_irqs = hif_ipci_enable_grp_irqs;
91 bus_ops->hif_disable_grp_irqs = hif_ipci_disable_grp_irqs;
92 #endif
93 #ifdef FEATURE_IRQ_AFFINITY
94 bus_ops->hif_set_grp_intr_affinity = &hif_ipci_set_grp_intr_affinity;
95 #endif
96 #ifdef WLAN_FEATURE_AFFINITY_MGR
97 bus_ops->hif_affinity_mgr_set_affinity = &hif_affinity_mgr_affine_irq;
98 #endif
99 return QDF_STATUS_SUCCESS;
100 }
101
102 /**
103 * hif_ipci_get_context_size() - return the size of the ipci context
104 *
105 * Return: the size of the context. (0 for invalid bus)
106 */
hif_ipci_get_context_size(void)107 int hif_ipci_get_context_size(void)
108 {
109 return sizeof(struct hif_ipci_softc);
110 }
111