Browse Source

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
bings 7 năm trước cách đây
mục cha
commit
60da5a87c4
2 tập tin đã thay đổi với 22 bổ sung7 xóa
  1. 14 7
      hif/src/sdio/if_sdio.c
  2. 8 0
      pld_stub/inc/pld_common.h

+ 14 - 7
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);

+ 8 - 0
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