#include "debug.h"
#ifndef __INLINE_INPUT_SYSTEM__
#define __INLINE_INPUT_SYSTEM__
#endif
#ifndef __INLINE_IBUF_CTRL__
#define __INLINE_IBUF_CTRL__
#endif
#ifndef __INLINE_CSI_RX__
#define __INLINE_CSI_RX__
#endif
#ifndef __INLINE_PIXELGEN__
#define __INLINE_PIXELGEN__
#endif
#ifndef __INLINE_STREAM2MMIO__
#define __INLINE_STREAM2MMIO__
#endif
#include <linux/args.h>
#include <linux/string.h>
#include "ia_css_debug.h"
#include "ia_css_debug_pipe.h"
#include "ia_css_irq.h"
#include "ia_css_stream.h"
#include "ia_css_pipeline.h"
#include "ia_css_isp_param.h"
#include "sh_css_params.h"
#include "ia_css_bufq.h"
#include "ia_css_queue.h"
#include "ia_css_isp_params.h"
#include "system_local.h"
#include "assert_support.h"
#include "print_support.h"
#include "fifo_monitor.h"
#include "input_formatter.h"
#include "dma.h"
#include "irq.h"
#include "gp_device.h"
#include "sp.h"
#include "isp.h"
#include "type_support.h"
#include "math_support.h"
#include "input_system.h"
#include "ia_css_tagger_common.h"
#include "sh_css_internal.h"
#include "ia_css_isys.h"
#include "sh_css_sp.h"
#include "css_trace.h"
#include "device_access.h"
#include "anr/anr_1.0/ia_css_anr.host.h"
#include "cnr/cnr_1.0/ia_css_cnr.host.h"
#include "csc/csc_1.0/ia_css_csc.host.h"
#include "de/de_1.0/ia_css_de.host.h"
#include "dp/dp_1.0/ia_css_dp.host.h"
#include "bnr/bnr_1.0/ia_css_bnr.host.h"
#include "fpn/fpn_1.0/ia_css_fpn.host.h"
#include "gc/gc_1.0/ia_css_gc.host.h"
#include "ob/ob_1.0/ia_css_ob.host.h"
#include "s3a/s3a_1.0/ia_css_s3a.host.h"
#include "sc/sc_1.0/ia_css_sc.host.h"
#include "tnr/tnr_1.0/ia_css_tnr.host.h"
#include "uds/uds_1.0/ia_css_uds_param.h"
#include "wb/wb_1.0/ia_css_wb.host.h"
#include "ynr/ynr_1.0/ia_css_ynr.host.h"
#include "aa/aa_2/ia_css_aa2.host.h"
#include "anr/anr_2/ia_css_anr2.host.h"
#include "cnr/cnr_2/ia_css_cnr2.host.h"
#include "de/de_2/ia_css_de2.host.h"
#include "gc/gc_2/ia_css_gc2.host.h"
#include "ynr/ynr_2/ia_css_ynr2.host.h"
#define DPG_START …
#define DPG_END …
#define ENABLE_LINE_MAX_LENGTH …
static struct pipe_graph_class { … } pg_inst = …;
static const char *const queue_id_to_str[] = …;
static const char *const pipe_id_to_str[] = …;
static char dot_id_input_bin[SH_CSS_MAX_BINARY_NAME + 10];
static char ring_buffer[200];
void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...)
{ … }
void ia_css_debug_set_dtrace_level(const unsigned int trace_level)
{ … }
unsigned int ia_css_debug_get_dtrace_level(void)
{ … }
static const char *debug_stream_format2str(const enum atomisp_input_format
stream_format)
{
switch (stream_format) {
case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY:
return "yuv420-8-legacy";
case ATOMISP_INPUT_FORMAT_YUV420_8:
return "yuv420-8";
case ATOMISP_INPUT_FORMAT_YUV420_10:
return "yuv420-10";
case ATOMISP_INPUT_FORMAT_YUV420_16:
return "yuv420-16";
case ATOMISP_INPUT_FORMAT_YUV422_8:
return "yuv422-8";
case ATOMISP_INPUT_FORMAT_YUV422_10:
return "yuv422-10";
case ATOMISP_INPUT_FORMAT_YUV422_16:
return "yuv422-16";
case ATOMISP_INPUT_FORMAT_RGB_444:
return "rgb444";
case ATOMISP_INPUT_FORMAT_RGB_555:
return "rgb555";
case ATOMISP_INPUT_FORMAT_RGB_565:
return "rgb565";
case ATOMISP_INPUT_FORMAT_RGB_666:
return "rgb666";
case ATOMISP_INPUT_FORMAT_RGB_888:
return "rgb888";
case ATOMISP_INPUT_FORMAT_RAW_6:
return "raw6";
case ATOMISP_INPUT_FORMAT_RAW_7:
return "raw7";
case ATOMISP_INPUT_FORMAT_RAW_8:
return "raw8";
case ATOMISP_INPUT_FORMAT_RAW_10:
return "raw10";
case ATOMISP_INPUT_FORMAT_RAW_12:
return "raw12";
case ATOMISP_INPUT_FORMAT_RAW_14:
return "raw14";
case ATOMISP_INPUT_FORMAT_RAW_16:
return "raw16";
case ATOMISP_INPUT_FORMAT_BINARY_8:
return "binary8";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT1:
return "generic-short1";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT2:
return "generic-short2";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT3:
return "generic-short3";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT4:
return "generic-short4";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT5:
return "generic-short5";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT6:
return "generic-short6";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT7:
return "generic-short7";
case ATOMISP_INPUT_FORMAT_GENERIC_SHORT8:
return "generic-short8";
case ATOMISP_INPUT_FORMAT_YUV420_8_SHIFT:
return "yuv420-8-shift";
case ATOMISP_INPUT_FORMAT_YUV420_10_SHIFT:
return "yuv420-10-shift";
case ATOMISP_INPUT_FORMAT_EMBEDDED:
return "embedded-8";
case ATOMISP_INPUT_FORMAT_USER_DEF1:
return "user-def-8-type-1";
case ATOMISP_INPUT_FORMAT_USER_DEF2:
return "user-def-8-type-2";
case ATOMISP_INPUT_FORMAT_USER_DEF3:
return "user-def-8-type-3";
case ATOMISP_INPUT_FORMAT_USER_DEF4:
return "user-def-8-type-4";
case ATOMISP_INPUT_FORMAT_USER_DEF5:
return "user-def-8-type-5";
case ATOMISP_INPUT_FORMAT_USER_DEF6:
return "user-def-8-type-6";
case ATOMISP_INPUT_FORMAT_USER_DEF7:
return "user-def-8-type-7";
case ATOMISP_INPUT_FORMAT_USER_DEF8:
return "user-def-8-type-8";
default:
assert(!"Unknown stream format");
return "unknown-stream-format";
}
};
static const char *debug_frame_format2str(const enum ia_css_frame_format
frame_format)
{ … }
static void debug_print_fifo_channel_state(const fifo_channel_state_t *state,
const char *descr)
{ … }
void ia_css_debug_dump_pif_a_isp_fifo_state(void)
{ … }
void ia_css_debug_dump_pif_b_isp_fifo_state(void)
{ … }
void ia_css_debug_dump_str2mem_sp_fifo_state(void)
{ … }
void ia_css_debug_dump_all_fifo_state(void)
{ … }
static void debug_binary_info_print(const struct ia_css_binary_xinfo *info)
{ … }
void ia_css_debug_binary_print(const struct ia_css_binary *bi)
{ … }
void ia_css_debug_frame_print(const struct ia_css_frame *frame,
const char *descr)
{ … }
#if SP_DEBUG != SP_DEBUG_NONE
void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state
*state)
{
#endif
#if SP_DEBUG == SP_DEBUG_DUMP
assert(state);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"current SP software counter: %d\n",
state->debug[0]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty output buffer queue head: 0x%x\n",
state->debug[1]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty output buffer queue tail: 0x%x\n",
state->debug[2]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a buffer queue head: 0x%x\n",
state->debug[3]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a buffer queue tail: 0x%x\n",
state->debug[4]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"full output buffer queue head: 0x%x\n",
state->debug[5]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"full output buffer queue tail: 0x%x\n",
state->debug[6]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"full s3a buffer queue head: 0x%x\n",
state->debug[7]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"full s3a buffer queue tail: 0x%x\n",
state->debug[8]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "event queue head: 0x%x\n",
state->debug[9]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "event queue tail: 0x%x\n",
state->debug[10]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"num of stages of current pipeline: 0x%x\n",
state->debug[11]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "DDR address of stage 1: 0x%x\n",
state->debug[12]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "DDR address of stage 2: 0x%x\n",
state->debug[13]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"current stage out_vf buffer idx: 0x%x\n",
state->debug[14]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"current stage output buffer idx: 0x%x\n",
state->debug[15]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"current stage s3a buffer idx: 0x%x\n",
state->debug[16]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first char of current stage name: 0x%x\n",
state->debug[17]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "current SP thread id: 0x%x\n",
state->debug[18]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty output buffer address 1: 0x%x\n",
state->debug[19]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty output buffer address 2: 0x%x\n",
state->debug[20]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty out_vf buffer address 1: 0x%x\n",
state->debug[21]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty out_vf buffer address 2: 0x%x\n",
state->debug[22]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a_hi buffer address 1: 0x%x\n",
state->debug[23]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a_hi buffer address 2: 0x%x\n",
state->debug[24]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a_lo buffer address 1: 0x%x\n",
state->debug[25]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty s3a_lo buffer address 2: 0x%x\n",
state->debug[26]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty dis_hor buffer address 1: 0x%x\n",
state->debug[27]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty dis_hor buffer address 2: 0x%x\n",
state->debug[28]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty dis_ver buffer address 1: 0x%x\n",
state->debug[29]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty dis_ver buffer address 2: 0x%x\n",
state->debug[30]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"empty param buffer address: 0x%x\n",
state->debug[31]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect frame address: 0x%x\n",
state->debug[32]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect frame container address: 0x%x\n",
state->debug[33]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect frame container payload: 0x%x\n",
state->debug[34]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_hi address: 0x%x\n",
state->debug[35]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_hi container address: 0x%x\n",
state->debug[36]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_hi container payload: 0x%x\n",
state->debug[37]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_lo address: 0x%x\n",
state->debug[38]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_lo container address: 0x%x\n",
state->debug[39]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"first incorrect s3a_lo container payload: 0x%x\n",
state->debug[40]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"number of calling flash start function: 0x%x\n",
state->debug[41]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"number of calling flash close function: 0x%x\n",
state->debug[42]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "number of flashed frame: 0x%x\n",
state->debug[43]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "flash in use flag: 0x%x\n",
state->debug[44]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"number of update frame flashed flag: 0x%x\n",
state->debug[46]);
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"number of active threads: 0x%x\n",
state->debug[45]);
#elif SP_DEBUG == SP_DEBUG_COPY
static int last_index;
int sp_index = state->index;
int n;
assert(state);
if (sp_index < last_index) {
last_index = 0;
}
if (last_index == 0) {
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"copy-trace init: sp_dbg_if_start_line=%d, sp_dbg_if_start_column=%d, sp_dbg_if_cropped_height=%d, sp_debg_if_cropped_width=%d\n",
state->if_start_line,
state->if_start_column,
state->if_cropped_height,
state->if_cropped_width);
}
if ((last_index + SH_CSS_SP_DBG_TRACE_DEPTH) < sp_index) {
last_index = sp_index - SH_CSS_SP_DBG_TRACE_DEPTH;
}
for (n = last_index; n < sp_index; n++) {
int i = n % SH_CSS_SP_DBG_TRACE_DEPTH;
if (state->trace[i].frame != 0) {
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"copy-trace: frame=%d, line=%d, pixel_distance=%d, mipi_used_dword=%d, sp_index=%d\n",
state->trace[i].frame,
state->trace[i].line,
state->trace[i].pixel_distance,
state->trace[i].mipi_used_dword,
state->trace[i].sp_index);
}
}
last_index = sp_index;
#elif SP_DEBUG == SP_DEBUG_TRACE
static char const *const id2filename[8] = {
"param_buffer.sp.c | tagger.sp.c | pipe_data.sp.c",
"isp_init.sp.c",
"sp_raw_copy.hive.c",
"dma_configure.sp.c",
"sp.hive.c",
"event_proxy_sp.hive.c",
"circular_buffer.sp.c",
"frame_buffer.sp.c"
};
static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = {
"default"
};
static int host_index_last[SH_CSS_SP_DBG_NR_OF_TRACES] = { 0 };
int t, n;
assert(state);
for (t = 0; t < SH_CSS_SP_DBG_NR_OF_TRACES; t++) {
int sp_index_last = state->index_last[t];
if (sp_index_last < host_index_last[t]) {
host_index_last[t] = 0;
}
if ((host_index_last[t] + SH_CSS_SP_DBG_TRACE_DEPTH) <
sp_index_last) {
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"Warning: trace %s has gap of %d traces\n",
trace_name[t],
(sp_index_last -
(host_index_last[t] +
SH_CSS_SP_DBG_TRACE_DEPTH)));
host_index_last[t] =
sp_index_last - SH_CSS_SP_DBG_TRACE_DEPTH;
}
for (n = host_index_last[t]; n < sp_index_last; n++) {
int i = n % SH_CSS_SP_DBG_TRACE_DEPTH;
int l = state->trace[t][i].location &
((1 << SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS) - 1);
int fid = state->trace[t][i].location >>
SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS;
int ts = state->trace[t][i].time_stamp;
if (ts) {
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"%05d trace=%s, file=%s:%d, data=0x%08x\n",
ts,
trace_name[t],
id2filename[fid], l,
state->trace[t][i].data);
}
}
host_index_last[t] = sp_index_last;
}
#elif SP_DEBUG == SP_DEBUG_MINIMAL
int i;
int base = 0;
int limit = SH_CSS_NUM_SP_DEBUG;
int step = 1;
assert(state);
for (i = base; i < limit; i += step) {
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
"sp_dbg_trace[%d] = %d\n",
i, state->debug[i]);
}
#endif
#if SP_DEBUG != SP_DEBUG_NONE
return;
}
#endif
void ia_css_debug_dump_sp_sw_debug_info(void)
{ … }
void ia_css_debug_enable_sp_sleep_mode(enum ia_css_sp_sleep_mode mode)
{ … }
void ia_css_debug_wake_up_sp(void)
{ … }
#define FIND_DMEM_PARAMS_TYPE(stream, kernel, type) …
#define FIND_DMEM_PARAMS(stream, kernel) …
static char *
findf_dmem_params(struct ia_css_stream *stream, short idx)
{ … }
void ia_css_debug_dump_isp_params(struct ia_css_stream *stream,
unsigned int enable)
{ … }
void sh_css_dump_sp_raw_copy_linecount(bool reduced)
{ … }
void ia_css_debug_dump_isp_binary(void)
{ … }
bool ia_css_debug_mode_init(void)
{ … }
bool
ia_css_debug_mode_disable_dma_channel(int dma_id,
int channel_id, int request_type)
{ … }
bool
ia_css_debug_mode_enable_dma_channel(int dma_id,
int channel_id, int request_type)
{ … }
static void __printf(1, 2) dtrace_dot(const char *fmt, ...)
{ … }
static void
ia_css_debug_pipe_graph_dump_frame(
const struct ia_css_frame *frame,
enum ia_css_pipe_id id,
char const *blob_name,
char const *frame_name,
bool in_frame)
{ … }
void
ia_css_debug_pipe_graph_dump_prologue(void)
{ … }
void ia_css_debug_pipe_graph_dump_epilogue(void)
{ … }
void
ia_css_debug_pipe_graph_dump_stage(
struct ia_css_pipeline_stage *stage,
enum ia_css_pipe_id id)
{ … }
void
ia_css_debug_pipe_graph_dump_sp_raw_copy(
struct ia_css_frame *out_frame)
{ … }
void
ia_css_debug_pipe_graph_dump_stream_config(
const struct ia_css_stream_config *stream_config)
{ … }
void
ia_css_debug_dump_resolution(
const struct ia_css_resolution *res,
const char *label)
{ … }
void
ia_css_debug_dump_frame_info(
const struct ia_css_frame_info *info,
const char *label)
{ … }
void
ia_css_debug_dump_capture_config(
const struct ia_css_capture_config *config)
{ … }
void
ia_css_debug_dump_pipe_extra_config(
const struct ia_css_pipe_extra_config *extra_config)
{ … }
void
ia_css_debug_dump_pipe_config(
const struct ia_css_pipe_config *config)
{ … }
void
ia_css_debug_dump_stream_config_source(
const struct ia_css_stream_config *config)
{ … }
void
ia_css_debug_dump_mipi_buffer_config(
const struct ia_css_mipi_buffer_config *config)
{ … }
void
ia_css_debug_dump_metadata_config(
const struct ia_css_metadata_config *config)
{ … }
void
ia_css_debug_dump_stream_config(
const struct ia_css_stream_config *config,
int num_pipes)
{ … }
#if TRACE_ENABLE_SP0 || TRACE_ENABLE_SP1 || TRACE_ENABLE_ISP
static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
{
#if defined(HAS_TRACER_V2)
u32 start_addr;
u32 start_addr_data;
u32 item_size;
u32 tmp;
u8 tid_val;
enum TRACE_DUMP_FORMAT dump_format;
int i, j, max_trace_points, point_num, limit = -1;
static u32 trace_read_buf[TRACE_BUFF_SIZE] = {0};
static struct trace_header_t header;
u8 *header_arr;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "~~~ Tracer ");
switch (proc_id) {
case TRACE_SP0_ID:
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "SP0");
start_addr = TRACE_SP0_ADDR;
start_addr_data = TRACE_SP0_DATA_ADDR;
item_size = TRACE_SP0_ITEM_SIZE;
max_trace_points = TRACE_SP0_MAX_POINTS;
break;
case TRACE_SP1_ID:
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "SP1");
start_addr = TRACE_SP1_ADDR;
start_addr_data = TRACE_SP1_DATA_ADDR;
item_size = TRACE_SP1_ITEM_SIZE;
max_trace_points = TRACE_SP1_MAX_POINTS;
break;
case TRACE_ISP_ID:
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ISP");
start_addr = TRACE_ISP_ADDR;
start_addr_data = TRACE_ISP_DATA_ADDR;
item_size = TRACE_ISP_ITEM_SIZE;
max_trace_points = TRACE_ISP_MAX_POINTS;
break;
default:
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"\t\ttraces are not supported for this processor ID - exiting\n");
return;
}
if (!IS_ISP2401) {
tmp = ia_css_device_load_uint32(start_addr);
point_num = (tmp >> 16) & 0xFFFF;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", tmp & 0xFF,
point_num);
} else {
header_arr = (uint8_t *)&header;
for (i = 0; i < (int)sizeof(struct trace_header_t); i++)
header_arr[i] = ia_css_device_load_uint8(start_addr + (i));
point_num = header.max_tracer_points;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", header.version,
point_num);
tmp = header.version;
}
if ((tmp & 0xFF) != TRACER_VER) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\t\tUnknown version - exiting\n");
return;
}
if (point_num > max_trace_points) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\t\tToo many points - exiting\n");
return;
}
for (i = 0; i < point_num; i++) {
trace_read_buf[i] = ia_css_device_load_uint32(start_addr_data +
(i * item_size));
if ((limit == (-1)) && (trace_read_buf[i] == 0))
limit = i;
}
if (IS_ISP2401) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Status:\n");
for (i = 0; i < SH_CSS_MAX_SP_THREADS; i++)
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"\tT%d: %3d (%02x) %6d (%04x) %10d (%08x)\n", i,
header.thr_status_byte[i], header.thr_status_byte[i],
header.thr_status_word[i], header.thr_status_word[i],
header.thr_status_dword[i], header.thr_status_dword[i]);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Scratch:\n");
for (i = 0; i < MAX_SCRATCH_DATA; i++)
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%10d (%08x) ",
header.scratch_debug[i], header.scratch_debug[i]);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\n");
}
if ((trace_read_buf[0] == 0) && (trace_read_buf[1] == 0)) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\t\tEmpty tracer - exiting\n");
return;
}
if ((limit == point_num - 1) ||
(trace_read_buf[limit + 1] ==
0))
limit = 0;
else
limit++;
for (i = 0; i < point_num; i++) {
j = (limit + i) % point_num;
if (trace_read_buf[j]) {
if (!IS_ISP2401) {
TRACE_DUMP_FORMAT dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
} else {
tid_val = FIELD_TID_UNPACK(trace_read_buf[j]);
dump_format = TRACE_DUMP_FORMAT_POINT;
if (tid_val == FIELD_TID_SEL_FORMAT_PAT) {
dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
}
}
switch (dump_format) {
case TRACE_DUMP_FORMAT_POINT:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d %d:%d value - %d\n",
j, FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_MINOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_VALUE24_HEX:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %x H\n",
j,
FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_VALUE24_DEC:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %d D\n",
j,
FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_POINT_NO_TID:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d %d:%d value - %x (%d)\n",
j,
FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
FIELD_MINOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_UNPACK(trace_read_buf[j]),
FIELD_VALUE_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_VALUE24:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %x (%d)\n",
j,
FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_VALUE24_TIMING:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d, %d, timing %x\n",
j,
FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
break;
case TRACE_DUMP_FORMAT_VALUE24_TIMING_DELTA:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE, "\t\t%d, %d, timing delta %x\n",
j,
FIELD_MAJOR_UNPACK(trace_read_buf[j]),
FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
break;
default:
ia_css_debug_dtrace(
IA_CSS_DEBUG_TRACE,
"no such trace dump format %d",
dump_format);
break;
}
}
}
#else
(void)proc_id;
#endif
}
#endif
void ia_css_debug_dump_trace(void)
{ … }
void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps)
{ … }