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 bus_ops->hif_bus_configure = &hif_ipci_bus_configure; 50 bus_ops->hif_get_config_item = &hif_dummy_get_config_item; 51 bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap; 52 bus_ops->hif_claim_device = &hif_dummy_claim_device; 53 bus_ops->hif_shutdown_device = &hif_ce_stop; 54 bus_ops->hif_stop = &hif_ce_stop; 55 bus_ops->hif_cancel_deferred_target_sleep = 56 &hif_dummy_cancel_deferred_target_sleep; 57 bus_ops->hif_irq_disable = &hif_dummy_irq_disable; 58 bus_ops->hif_irq_enable = &hif_dummy_irq_enable; 59 bus_ops->hif_dump_registers = &hif_ipci_dump_registers; 60 bus_ops->hif_dump_target_memory = &hif_ce_dump_target_memory; 61 bus_ops->hif_ipa_get_ce_resource = &hif_ce_ipa_get_ce_resource; 62 bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call; 63 bus_ops->hif_enable_power_management = 64 &hif_ipci_enable_power_management; 65 bus_ops->hif_disable_power_management = 66 &hif_ipci_disable_power_management; 67 bus_ops->hif_grp_irq_configure = &hif_ipci_configure_grp_irq; 68 bus_ops->hif_display_stats = 69 &hif_ipci_display_stats; 70 bus_ops->hif_clear_stats = 71 &hif_ipci_clear_stats; 72 bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary; 73 bus_ops->hif_needs_bmi = &hif_ipci_needs_bmi; 74 bus_ops->hif_config_irq_affinity = 75 &hif_dummy_config_irq_affinity; 76 77 return QDF_STATUS_SUCCESS; 78 } 79 80 /** 81 * hif_ipci_get_context_size() - return the size of the ipci context 82 * 83 * Return the size of the context. (0 for invalid bus) 84 */ 85 int hif_ipci_get_context_size(void) 86 { 87 return sizeof(struct hif_ipci_softc); 88 } 89