From 60da5a87c454eb71263293cb00e6ca173d657490 Mon Sep 17 00:00:00 2001 From: bings Date: Tue, 27 Jun 2017 09:41:16 +0800 Subject: [PATCH] qcacmn: Fix crash caused by sdio ramdump allocation For TF sdio chip with platform driver, ramdump is configured in platform driver. Driver can get the virtual memory, but it can't call ioremap again. If there is a platform driver, ramdump should be allocated in platform driver, and if there is no platform driver, ramdump should be allocated in driver. CRs-Fixed: 2060381 Change-Id: Ia2a32a4895f354e365522a30bbfac949ccb7a391 --- hif/src/sdio/if_sdio.c | 21 ++++++++++++++------- pld_stub/inc/pld_common.h | 8 ++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/hif/src/sdio/if_sdio.c b/hif/src/sdio/if_sdio.c index 65ba4d6fb387..f117f04ec244 100644 --- a/hif/src/sdio/if_sdio.c +++ b/hif/src/sdio/if_sdio.c @@ -54,6 +54,7 @@ #include "pktlog_ac.h" #endif #include "epping_main.h" +#include "pld_sdio.h" #ifndef ATH_BUS_PM #ifdef CONFIG_PM @@ -168,14 +169,18 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle) scn->ol_sc = *ol_sc; ol_sc->target_info.target_type = target_type; -#ifndef TARGET_DUMP_FOR_NON_QC_PLATFORM - scn->ramdump_base = ioremap(RAMDUMP_ADDR, RAMDUMP_SIZE); - scn->ramdump_size = RAMDUMP_SIZE; - if (scn->ramdump_base == NULL) { - scn->ramdump_base = 0; - scn->ramdump_size = 0; + scn->ramdump_base = pld_hif_sdio_get_virt_ramdump_mem( + scn->aps_osdev.device, + &scn->ramdump_size); + if (scn->ramdump_base == NULL || !scn->ramdump_size) { + QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR, + "%s: Failed to get RAM dump memory address or size!\n", + __func__); + } else { + QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO, + "%s: ramdump base 0x%p size %d\n", __func__, + scn->ramdump_base, (int)scn->ramdump_size); } -#endif if (athdiag_procfs_init(scn) != 0) { QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR, @@ -190,6 +195,8 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle) return 0; err_attach1: + if (scn->ramdump_base) + pld_hif_sdio_release_ramdump_mem(scn->ramdump_base); qdf_mem_free(ol_sc); err_attach: qdf_mem_free(scn); diff --git a/pld_stub/inc/pld_common.h b/pld_stub/inc/pld_common.h index 7ff58035e42a..750aeb1a7906 100644 --- a/pld_stub/inc/pld_common.h +++ b/pld_stub/inc/pld_common.h @@ -260,6 +260,14 @@ static inline int pld_athdiag_write(struct device *dev, { return 0; } +static inline void *pld_hif_sdio_get_virt_ramdump_mem(struct device *dev, + unsigned long *size) +{ + return NULL; +} +static inline void pld_hif_sdio_release_ramdump_mem(unsigned long *address) +{ +} #endif #endif