From 247f09b86ac6509d6fb15e11ec124707220d4c24 Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Wed, 6 Apr 2016 21:21:40 -0700 Subject: [PATCH] qcacmn: Remove icnss_dispatch_irq icnss_dispatch_irq is a stub for a non-existent function. Make a pci function that doesn't use a global data structure. Change-Id: I636d59cb465acf1366269d96a5dcacf910f8d78c CRs-Fixed: 1002083 --- hif/inc/hif_napi.h | 2 +- hif/src/ce/ce_tasklet.c | 25 ++++-- hif/src/ce/ce_tasklet.h | 2 + hif/src/icnss_stub/icnss_stub.c | 146 +------------------------------- hif/src/pcie/if_pci.c | 50 ++++++++++- hif/src/pcie/if_pci.h | 1 - 6 files changed, 73 insertions(+), 153 deletions(-) diff --git a/hif/inc/hif_napi.h b/hif/inc/hif_napi.h index 5a7e338f43c4..2ce3ea5a0c93 100644 --- a/hif/inc/hif_napi.h +++ b/hif/inc/hif_napi.h @@ -89,7 +89,7 @@ int hif_napi_enabled(struct hif_opaque_softc *hif, int ce); /* called from hdd (napi_poll), using napi id as a selector */ void hif_napi_enable_irq(struct hif_opaque_softc *hif, int id); -/* called by ce_tasklet.c::ce_irq_handler */ +/* called by ce_tasklet.c::ce_dispatch_interrupt*/ int hif_napi_schedule(struct hif_opaque_softc *scn, int ce_id); /* called by hdd_napi, which is called by kernel */ diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c index 43bd5b2a1bd8..b40161087448 100644 --- a/hif/src/ce/ce_tasklet.c +++ b/hif/src/ce/ce_tasklet.c @@ -39,6 +39,7 @@ #include "ce_api.h" #include "ce_reg.h" #include "ce_internal.h" +#include "ce_tasklet.h" #ifdef CONFIG_CNSS #include #include "platform_icnss.h" @@ -249,20 +250,33 @@ void ce_tasklet_kill(struct hif_softc *scn) } qdf_atomic_set(&scn->active_tasklet_cnt, 0); } + /** - * ce_irq_handler() - ce_irq_handler - * @ce_id: ce_id + * hif_snoc_interrupt_handler() - hif_snoc_interrupt_handler + * @irq: irq coming from kernel * @context: context * * Return: N/A */ -static irqreturn_t ce_irq_handler(int irq, void *context) +static irqreturn_t hif_snoc_interrupt_handler(int irq, void *context) { struct ce_tasklet_entry *tasklet_entry = context; + return ce_dispatch_interrupt(icnss_get_ce_id(irq), tasklet_entry); +} + +/** + * ce_dispatch_interrupt() - dispatch an interrupt to a processing context + * @ce_id: ce_id + * @tasklet_entry: context + * + * Return: N/A + */ +irqreturn_t ce_dispatch_interrupt(int ce_id, + struct ce_tasklet_entry *tasklet_entry) +{ struct HIF_CE_state *hif_ce_state = tasklet_entry->hif_ce_state; struct hif_softc *scn = HIF_GET_SOFTC(hif_ce_state); struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn); - int ce_id = icnss_get_ce_id(irq); if (tasklet_entry->ce_id != ce_id) { HIF_ERROR("%s: ce_id (expect %d, received %d) does not match", @@ -354,7 +368,8 @@ QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask) for (id = 0; id < CE_COUNT_MAX; id++) { if ((mask & (1 << id)) && hif_ce_state->tasklets[id].inited) { - ret = icnss_ce_request_irq(id, ce_irq_handler, + ret = icnss_ce_request_irq(id, + hif_snoc_interrupt_handler, irqflags, ce_name[id], &hif_ce_state->tasklets[id]); if (ret) { diff --git a/hif/src/ce/ce_tasklet.h b/hif/src/ce/ce_tasklet.h index d20402e348eb..d2fa22c64b33 100644 --- a/hif/src/ce/ce_tasklet.h +++ b/hif/src/ce/ce_tasklet.h @@ -33,4 +33,6 @@ void ce_tasklet_init(struct HIF_CE_state *hif_ce_state, uint32_t mask); void ce_tasklet_kill(struct hif_softc *scn); QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask); QDF_STATUS ce_unregister_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask); +irqreturn_t ce_dispatch_interrupt(int irq, + struct ce_tasklet_entry *tasklet_entry); #endif /* __CE_TASKLET_H__ */ diff --git a/hif/src/icnss_stub/icnss_stub.c b/hif/src/icnss_stub/icnss_stub.c index 86b9b34750c4..20ed4ce61131 100644 --- a/hif/src/icnss_stub/icnss_stub.c +++ b/hif/src/icnss_stub/icnss_stub.c @@ -36,8 +36,6 @@ #include "qwlan_version.h" #include -static int icnss_get_irq_num(int ce_id); - /** * struct icnss_stub_entry * @@ -63,9 +61,6 @@ struct icnss_stub_context { struct icnss_stub_entry stub[ICNSS_MAX_IRQ_REGISTRATIONS]; uint32_t regged_irq; }; - -static struct icnss_stub_context cnss_stub; - #ifndef QCA_WIFI_3_0_ADRASTEA /** * icnss_wlan_enable() - icnss_wlan_enable @@ -210,16 +205,6 @@ int icnss_ce_request_irq(int ce_id, unsigned long flags, const char *name, void *context) { - if (ce_id >= ICNSS_MAX_IRQ_REGISTRATIONS) { - HIF_ERROR("%s: invalid ce_id = %d", __func__, ce_id); - return -EINVAL; - } - - cnss_stub.stub[ce_id].irq_handler = handler; - cnss_stub.stub[ce_id].ce_id = ce_id; - cnss_stub.stub[ce_id].data = context; - cnss_stub.stub[ce_id].name = name; - cnss_stub.regged_irq |= (1 << ce_id); return 0; } @@ -231,141 +216,12 @@ int icnss_ce_request_irq(int ce_id, */ int icnss_ce_free_irq(int ce_id, void *context) { - if (ce_id >= ICNSS_MAX_IRQ_REGISTRATIONS) { - HIF_ERROR("%s: invalid ce_id = %d", __func__, ce_id); - return -EINVAL; - } - - if (cnss_stub.stub[ce_id].data != context) { - HIF_ERROR("%s: context match failure for ce_id %d", - __func__, ce_id); - return -EINVAL; - } - - if (cnss_stub.regged_irq & (1 << ce_id)) { - cnss_stub.stub[ce_id].irq_handler = NULL; - cnss_stub.stub[ce_id].ce_id = 0; - cnss_stub.stub[ce_id].data = 0; - cnss_stub.stub[ce_id].name = NULL; - cnss_stub.regged_irq &= ~(1 << ce_id); - } return 0; } -/** - * icnss_dispatch_one_ce_irq() - icnss_dispatch_one_ce_irq - * @ce_id: ce_id - * - * Return: irqreturn_t - */ -static irqreturn_t icnss_dispatch_one_ce_irq(int ce_id) -{ - irqreturn_t ret = IRQ_NONE; - - if (cnss_stub.stub[ce_id].irq_handler) - ret = cnss_stub.stub[ce_id].irq_handler( - icnss_get_irq_num(ce_id), - (void *)cnss_stub.stub[ce_id].data); - else - HIF_ERROR( - "%sd: error - ce_id = %d, no IRQ handler", - __func__, ce_id); - - return ret; -} - -/** - * icnss_dispatch_ce_irq() - icnss_dispatch_ce_irq - * @scn: scn - * - * Return: N/A - */ -void icnss_dispatch_ce_irq(struct hif_softc *scn) -{ - uint32_t intr_summary; - int id; - irqreturn_t ret; - - if (scn->hif_init_done != true) - return; - - if (Q_TARGET_ACCESS_BEGIN(scn) < 0) - return; - - intr_summary = CE_INTERRUPT_SUMMARY(scn); - - if (intr_summary == 0) { - if ((scn->target_status != OL_TRGET_STATUS_RESET) && - (!qdf_atomic_read(&scn->link_suspended))) { - - hif_write32_mb(scn->mem + - (SOC_CORE_BASE_ADDRESS | - PCIE_INTR_ENABLE_ADDRESS), - HOST_GROUP0_MASK); - - hif_read32_mb(scn->mem + - (SOC_CORE_BASE_ADDRESS | - PCIE_INTR_ENABLE_ADDRESS)); - } - Q_TARGET_ACCESS_END(scn); - return; - } else { - Q_TARGET_ACCESS_END(scn); - } - - scn->ce_irq_summary = intr_summary; - for (id = 0; intr_summary && (id < scn->ce_count); id++) { - if (intr_summary & (1 << id)) { - intr_summary &= ~(1 << id); - ret = icnss_dispatch_one_ce_irq(id); - } - } -} - -/** - * icnss_get_soc_info() - get soc info - * - * This function query the soc information from the platform - * driver - * - * @info: struct icnss_soc_info - * - * Return: 0 for success - */ -int icnss_get_soc_info(void *hif_ctx, struct icnss_soc_info *info) -{ - struct hif_softc *scn = hif_ctx; - - if (!scn) { - HIF_ERROR("%s: SCN = NULL", __func__); - return -EINVAL; - } - - info->v_addr = scn->mem; - info->p_addr = scn->mem_pa; - info->version = 0; - return 0; -} - - -/* icnss_get_irq_num() - generate a number to represent an irq number -*/ -static int icnss_get_irq_num(int ce_id) -{ - if (ce_id < CE_COUNT_MAX && ce_id >= 0) - return ce_id + 100; - - pr_err("icnss: No irq registered for CE id %d\n", ce_id); - return -EINVAL; -} - int icnss_get_ce_id(int irq) { - int ce_id = irq - 100; - if (ce_id < CE_COUNT_MAX && ce_id >= 0) - return ce_id; - - pr_err("icnss: No matching CE id for irq %d\n", irq); + pr_err("icnss: icnss not valid for pci %d\n", irq); return -EINVAL; } #endif /* HIF_PCI */ diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 82cda0539eb0..0d78d85d5878 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -124,6 +124,54 @@ void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc) } #endif +/** + * pci_dispatch_ce_irq() - pci_dispatch_ce_irq + * @scn: scn + * + * Return: N/A + */ +static void pci_dispatch_interrupt(struct hif_softc *scn) +{ + uint32_t intr_summary; + int id; + struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); + + if (scn->hif_init_done != true) + return; + + if (Q_TARGET_ACCESS_BEGIN(scn) < 0) + return; + + intr_summary = CE_INTERRUPT_SUMMARY(scn); + + if (intr_summary == 0) { + if ((scn->target_status != OL_TRGET_STATUS_RESET) && + (!qdf_atomic_read(&scn->link_suspended))) { + + hif_write32_mb(scn->mem + + (SOC_CORE_BASE_ADDRESS | + PCIE_INTR_ENABLE_ADDRESS), + HOST_GROUP0_MASK); + + hif_read32_mb(scn->mem + + (SOC_CORE_BASE_ADDRESS | + PCIE_INTR_ENABLE_ADDRESS)); + } + Q_TARGET_ACCESS_END(scn); + return; + } else { + Q_TARGET_ACCESS_END(scn); + } + + scn->ce_irq_summary = intr_summary; + for (id = 0; intr_summary && (id < scn->ce_count); id++) { + if (intr_summary & (1 << id)) { + intr_summary &= ~(1 << id); + ce_dispatch_interrupt(id, &hif_state->tasklets[id]); + } + } +} + static irqreturn_t hif_pci_interrupt_handler(int irq, void *arg) { struct hif_pci_softc *sc = (struct hif_pci_softc *)arg; @@ -249,7 +297,7 @@ static irqreturn_t hif_pci_interrupt_handler(int irq, void *arg) qdf_atomic_inc(&scn->active_tasklet_cnt); tasklet_schedule(&sc->intr_tq); } else { - icnss_dispatch_ce_irq(scn); + pci_dispatch_interrupt(scn); } return IRQ_HANDLED; diff --git a/hif/src/pcie/if_pci.h b/hif/src/pcie/if_pci.h index 86e45bd4ad13..a36a10f7d7fb 100644 --- a/hif/src/pcie/if_pci.h +++ b/hif/src/pcie/if_pci.h @@ -146,7 +146,6 @@ struct hif_pci_softc { }; bool hif_pci_targ_is_present(struct hif_softc *scn, void *__iomem *mem); -void icnss_dispatch_ce_irq(struct hif_softc *scn); int hif_configure_irq(struct hif_softc *sc); void hif_pci_cancel_deferred_target_sleep(struct hif_softc *scn);