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