We only want this code when testing.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Enable notifications to registered clients on the event of power errror
trying to suspend bridge driver. Say Y, to signal this event as a fatal
error, this will require a bridge restart to recover.
+
+config TIDSPBRIDGE_BACKTRACE
+ bool "Dump backtraces on fatal errors"
+ depends on TIDSPBRIDGE
+ help
+ Enable useful information to backtrace fatal errors. Say Y if you
+ want to dump information for testing purposes.
struct mgr_processorextinfo ext_proc_info;
struct cmm_object *hcmm_mgr; /* Shared Mem Mngr */
struct work_struct io_workq; /* workqueue */
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
u32 ul_trace_buffer_begin; /* Trace message start address */
u32 ul_trace_buffer_end; /* Trace message end address */
u32 ul_trace_buffer_current; /* Trace message current address */
}
/* Initialize chnl_mgr object */
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
pio_mgr->pmsg = NULL;
#endif
pio_mgr->hchnl_mgr = hchnl_mgr;
/* Free IO DPC object */
tasklet_kill(&hio_mgr->dpc_tasklet);
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
kfree(hio_mgr->pmsg);
#endif
dsp_wdt_exit();
status = -EFAULT;
}
if (DSP_SUCCEEDED(status)) {
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
status =
cod_get_sym_value(cod_man, DSP_TRACESEC_END, &shm0_end);
#else
hmsg_mgr->max_msgs);
memset((void *)hio_mgr->shared_mem, 0, sizeof(struct shm));
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
/* Get the start address of trace buffer */
status = cod_get_sym_value(cod_man, SYS_PUTCBEG,
&hio_mgr->ul_trace_buffer_begin);
(pio_mgr->intr_val < DEH_LIMIT)) {
/* Notify DSP/BIOS exception */
if (hdeh_mgr) {
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
print_dsp_debug_trace(pio_mgr);
#endif
bridge_deh_notify(hdeh_mgr, DSP_SYSERROR,
return 0;
}
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+void io_sm_init(void)
+{
+ /* Do nothing */
+}
+
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
void print_dsp_debug_trace(struct io_mgr *hio_mgr)
{
u32 ul_new_message_length = 0, ul_gpp_cur_pointer;
}
#endif
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/*
* ======== print_dsp_trace_buffer ========
* Prints the trace buffer returned from the DSP (if DBG_Trace is enabled).
return status;
}
-void io_sm_init(void)
-{
- /* Do nothing */
-}
/**
* dump_dsp_stack() - This function dumps the data on the DSP stack.
* @bridge_context: Bridge driver's device context pointer.
func_end:
kfree(module_struct);
}
-
+#endif
return ntfy_unregister(deh->ntfy_obj, hnotification);
}
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
static void mmu_fault_print_stack(struct bridge_dev_context *dev_context)
{
struct cfg_hostres *resources;
hw_mmu_disable(resources->dw_dmmu_base);
free_page((unsigned long)dummy_va_addr);
}
+#endif
static inline const char *event_to_string(int event)
{
case DSP_SYSERROR:
dev_err(bridge, "%s: %s, info=0x%x", __func__,
str, info);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
dump_dl_modules(dev_context);
dump_dsp_stack(dev_context);
+#endif
break;
case DSP_MMUFAULT:
dev_err(bridge, "%s: %s, addr=0x%x", __func__,
str, fault_addr);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
print_dsp_trace_buffer(dev_context);
dump_dl_modules(dev_context);
mmu_fault_print_stack(dev_context);
+#endif
break;
default:
dev_err(bridge, "%s: %s", __func__, str);
gs_free(ptr);
}
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/**
* gh_iterate() - This function goes through all the elements in the hash table
* looking for the dsp symbols.
}
}
}
+#endif
extern void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs);
extern int dbll_unload_sect(struct dbll_library_obj *lib,
char *sectName, struct dbll_attrs *attrs);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
bool dbll_find_dsp_symbol(struct dbll_library_obj *zl_lib, u32 address,
u32 offset_range, u32 *sym_addr_output, char *name_output);
+#endif
#endif /* DBLL_ */
extern void *gh_find(struct gh_t_hash_tab *hash_tab, void *key);
extern void gh_init(void);
extern void *gh_insert(struct gh_t_hash_tab *hash_tab, void *key, void *value);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
void gh_iterate(struct gh_t_hash_tab *hash_tab,
void (*callback)(void *, void *), void *user_data);
+#endif
#endif /* GH_ */
extern void io_sm_init(void);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/*
* ========print_dsp_trace_buffer ========
* Print DSP tracebuffer.
void dump_dl_modules(struct bridge_dev_context *bridge_context);
-#ifdef CONFIG_TIDSPBRIDGE_DEBUG
+#endif
+#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
void print_dsp_debug_trace(struct io_mgr *hio_mgr);
#endif
enum nldr_phase phase);
extern int nldr_unload(struct nldr_nodeobject *nldr_node_obj,
enum nldr_phase phase);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
int nldr_find_addr(struct nldr_nodeobject *nldr_node, u32 sym_addr,
u32 offset_range, void *offset_output, char *sym_name);
+#endif
#endif /* NLDR_ */
OUT struct dsp_ndbprops
*node_props);
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/**
* node_find_addr() - Find the closest symbol to the given address.
*
char *sym_name);
enum node_state node_get_state(void *hnode);
+#endif
#endif /* NODE_ */
{
}
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/**
* find_symbol_context - Basic symbol context structure
* @address: Symbol Adress
return status;
}
+#endif
return b;
}
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/**
* nldr_find_addr() - Find the closest symbol to the given address based on
* dynamic node object.
return status;
}
+#endif
return ul_num_bytes;
}
+#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/*
* ======== node_find_addr ========
*/
return status;
}
-
+#endif