Forráskód Böngészése

qcacmn: Abstract bus debug dump in hif layer

Remove direct call to CE debug routine from ol_fw and
hif main layer. Abstract the bus debug dump
register routines to respective hif bus layer.

Change-Id: I8b6f325f12aaa99e4f7461f9da26b7f60259c8f8
CRs-Fixed: 964031
Govind Singh 9 éve
szülő
commit
2443fb341a
6 módosított fájl, 100 hozzáadás és 15 törlés
  1. 1 2
      hif/inc/hif.h
  2. 34 0
      hif/src/ce/ce_main.c
  3. 4 0
      hif/src/ce/ce_main.h
  4. 6 8
      hif/src/hif_main.c
  5. 31 1
      hif/src/pcie/if_pci.c
  6. 24 4
      hif/src/snoc/if_snoc.c

+ 1 - 2
hif/inc/hif.h

@@ -619,7 +619,6 @@ void hif_set_target_sleep(struct ol_softc *scn, bool sleep_ok,
 		     bool wait_for_it);
 int hif_check_fw_reg(struct ol_softc *scn);
 int hif_check_soc_status(struct ol_softc *scn);
-void dump_ce_debug_register(struct ol_softc *scn);
 void hif_get_hw_info(void *scn, u32 *version, u32 *revision,
 		     const char **target_name);
 void hif_set_fw_info(void *scn, u32 target_fw_version);
@@ -697,7 +696,7 @@ void hif_process_runtime_suspend_failure(void);
 void hif_process_runtime_resume_success(void);
 #endif
 
-int dump_ce_register(struct ol_softc *scn);
+int hif_dump_registers(struct ol_softc *scn);
 int ol_copy_ramdump(struct ol_softc *scn);
 void hif_pktlogmod_exit(void *hif_ctx);
 void hif_crash_shutdown(void *hif_ctx);

+ 34 - 0
hif/src/ce/ce_main.c

@@ -2424,3 +2424,37 @@ static inline void hif_config_rri_on_ddr(struct ol_softc *scn)
 	return;
 }
 #endif
+
+/**
+ * hif_dump_ce_registers() - dump ce registers
+ * @scn: ol_softc pointer.
+ *
+ * Output the copy engine registers
+ *
+ * Return: 0 for success or error code
+ */
+int hif_dump_ce_registers(struct ol_softc *scn)
+{
+	uint32_t ce_reg_address = CE0_BASE_ADDRESS;
+	uint32_t ce_reg_values[CE_COUNT_MAX][CE_USEFUL_SIZE >> 2];
+	uint32_t ce_reg_word_size = CE_USEFUL_SIZE >> 2;
+	uint16_t i;
+	CDF_STATUS status;
+
+	for (i = 0; i < CE_COUNT_MAX; i++, ce_reg_address += CE_OFFSET) {
+		status = hif_diag_read_mem(scn, ce_reg_address,
+					   (uint8_t *) &ce_reg_values[i][0],
+					   ce_reg_word_size * sizeof(uint32_t));
+
+		if (status != CDF_STATUS_SUCCESS) {
+				HIF_ERROR("Dumping CE register failed!");
+				return -EACCES;
+		}
+		HIF_ERROR("CE%d Registers:", i);
+		cdf_trace_hex_dump(CDF_MODULE_ID_HIF, CDF_TRACE_LEVEL_DEBUG,
+				   (uint8_t *) &ce_reg_values[i][0],
+				   ce_reg_word_size * sizeof(uint32_t));
+	}
+
+	return 0;
+}

+ 4 - 0
hif/src/ce/ce_main.h

@@ -35,6 +35,9 @@
 #define CE_HTT_T2H_MSG 1
 #define CE_HTT_H2T_MSG 4
 
+#define CE_OFFSET		0x00000400
+#define CE_USEFUL_SIZE		0x00000058
+
 /**
  * enum ce_id_type
  *
@@ -129,4 +132,5 @@ struct HIF_CE_state {
 	/* Copy Engine used for Diagnostic Accesses */
 	struct CE_handle *ce_diag;
 };
+int hif_dump_ce_registers(struct ol_softc *scn);
 #endif /* __CE_H__ */

+ 6 - 8
hif/src/hif_main.c

@@ -714,8 +714,7 @@ void hif_disable(void *hif_ctx, enum hif_disable_type type)
 
 
 /**
- * hif_crash_shutdown_dump_ce_register():
- * hif_crash_shutdown_dump_ce_register
+ * hif_crash_shutdown_dump_bus_register() - dump bus registers
  * @hif_ctx: hif_ctx
  *
  * Return: n/a
@@ -723,16 +722,15 @@ void hif_disable(void *hif_ctx, enum hif_disable_type type)
 #if defined(TARGET_RAMDUMP_AFTER_KERNEL_PANIC) \
 && defined(HIF_PCI) && defined(DEBUG)
 
-static void hif_crash_shutdown_dump_ce_register(void *hif_ctx)
+static void hif_crash_shutdown_dump_bus_register(void *hif_ctx)
 {
 	struct ol_softc *scn = hif_ctx;
 
-	if (hif_check_soc_status(scn)
-	    || dump_ce_register(scn)) {
+	if (hif_check_soc_status(scn))
 		return;
-	}
 
-	dump_ce_debug_register(scn);
+	if (hif_dump_registers(scn))
+		HIF_ERROR("Failed to dump bus registers!");
 }
 
 /**
@@ -768,7 +766,7 @@ void hif_crash_shutdown(void *hif_ctx)
 		return;
 	}
 
-	hif_crash_shutdown_dump_ce_register(hif_ctx);
+	hif_crash_shutdown_dump_bus_register(hif_ctx);
 
 	if (ol_copy_ramdump(scn))
 		goto out;

+ 31 - 1
hif/src/pcie/if_pci.c

@@ -607,7 +607,15 @@ int hif_check_soc_status(struct ol_softc *scn)
 	return 0;
 }
 
-void dump_ce_debug_register(struct ol_softc *scn)
+/**
+ * hif_dump_pci_registers(): dump PCI debug registers
+ * @scn: struct ol_softc
+ *
+ * This function dumps pci debug registers
+ *
+ * Return: void
+ */
+static void hif_dump_pci_registers(struct ol_softc *scn)
 {
 	struct hif_pci_softc *sc = scn->hif_sc;
 	void __iomem *mem = sc->mem;
@@ -732,6 +740,28 @@ void dump_ce_debug_register(struct ol_softc *scn)
 	A_TARGET_ACCESS_END(scn);
 }
 
+/**
+ * hif_dump_registers(): dump bus debug registers
+ * @scn: struct ol_softc
+ *
+ * This function dumps hif bus debug registers
+ *
+ * Return: 0 for success or error code
+ */
+int hif_dump_registers(struct ol_softc *scn)
+{
+	int status;
+
+	status = hif_dump_ce_registers(scn);
+
+	if (status)
+		HIF_ERROR("%s: Dump CE Registers Failed", __func__);
+
+	hif_dump_pci_registers(scn);
+
+	return 0;
+}
+
 /*
  * Handler for a per-engine interrupt on a PARTICULAR CE.
  * This is used in cases where each CE has a private

+ 24 - 4
hif/src/snoc/if_snoc.c

@@ -101,19 +101,39 @@ void hif_disable_isr(void *hif_ctx)
 }
 
 /**
- * dump_ce_debug_register(): dump CE debug registers
+ * hif_dump_snoc_registers(): dump CE debug registers
+ * @scn: struct ol_softc
  *
  * This function dumps CE debug registers
  *
- * @scn: struct ol_softc
- *
  * Return: void
  */
-void dump_ce_debug_register(struct ol_softc *scn)
+static void hif_dump_snoc_registers(struct ol_softc *scn)
 {
 	return;
 }
 
+/**
+ * hif_dump_registers(): dump bus debug registers
+ * @scn: struct ol_softc
+ *
+ * This function dumps hif bus debug registers
+ *
+ * Return: 0 for success or error code
+ */
+int hif_dump_registers(struct ol_softc *scn)
+{
+	int status;
+
+	status = hif_dump_ce_registers(scn);
+	if (status)
+		HIF_ERROR("%s: Dump CE Registers Failed", __func__);
+
+	hif_dump_snoc_registers(scn);
+
+	return 0;
+}
+
 /**
  * hif_bus_suspend() - suspend the bus
  *