Commit bd3016e9 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: atomisp: css_trace.h: use the newest tracing code

The css_trace header for ISP2401 also builds on older versions, and
seems to be compatible with all versions. So, remove all ifdefs
in favor of the CSP2401 version.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 1c874c13
......@@ -16,9 +16,7 @@
#define __CSS_TRACE_H_
#include <type_support.h>
#ifdef ISP2401
#include "sh_css_internal.h" /* for SH_CSS_MAX_SP_THREADS */
#endif
/*
structs and constants for tracing
......@@ -31,48 +29,31 @@ struct trace_item_t {
u16 counter;
};
#ifdef ISP2401
#define MAX_SCRATCH_DATA 4
#define MAX_CMD_DATA 2
#endif
/* trace header: holds the version and the topology of the tracer. */
struct trace_header_t {
#ifndef ISP2401
/* 1st dword */
#else
/* 1st dword: descriptor */
#endif
u8 version;
u8 max_threads;
u16 max_tracer_points;
#ifdef ISP2401
/* 2nd field: command + data */
#endif
/* 2nd dword */
u32 command;
/* 3rd & 4th dword */
#ifndef ISP2401
u32 data[2];
#else
u32 data[MAX_CMD_DATA];
/* 3rd field: debug pointer */
#endif
/* 5th & 6th dword: debug pointer mechanism */
u32 debug_ptr_signature;
u32 debug_ptr_value;
#ifdef ISP2401
/* Rest of the header: status & scratch data */
u8 thr_status_byte[SH_CSS_MAX_SP_THREADS];
u16 thr_status_word[SH_CSS_MAX_SP_THREADS];
u32 thr_status_dword[SH_CSS_MAX_SP_THREADS];
u32 scratch_debug[MAX_SCRATCH_DATA];
#endif
};
#ifndef ISP2401
#define TRACER_VER 2
#else
/* offsets for master_port read/write */
#define HDR_HDR_OFFSET 0 /* offset of the header */
#define HDR_COMMAND_OFFSET offsetof(struct trace_header_t, command)
......@@ -94,7 +75,6 @@ Trace version history:
*/
#define TRACER_VER 4
#endif
#define TRACE_BUFF_ADDR 0xA000
#define TRACE_BUFF_SIZE 0x1000 /* 4K allocated */
......@@ -102,40 +82,20 @@ Trace version history:
#define TRACE_ENABLE_SP1 0
#define TRACE_ENABLE_ISP 0
#ifndef ISP2401
typedef enum {
#else
enum TRACE_CORE_ID {
#endif
TRACE_SP0_ID,
TRACE_SP1_ID,
TRACE_ISP_ID
#ifndef ISP2401
} TRACE_CORE_ID;
#else
};
#endif
/* TODO: add timing format? */
#ifndef ISP2401
typedef enum {
TRACE_DUMP_FORMAT_POINT,
TRACE_DUMP_FORMAT_VALUE24_HEX,
TRACE_DUMP_FORMAT_VALUE24_DEC,
#else
enum TRACE_DUMP_FORMAT {
TRACE_DUMP_FORMAT_POINT_NO_TID,
TRACE_DUMP_FORMAT_VALUE24,
#endif
TRACE_DUMP_FORMAT_VALUE24_TIMING,
#ifndef ISP2401
TRACE_DUMP_FORMAT_VALUE24_TIMING_DELTA
} TRACE_DUMP_FORMAT;
#else
TRACE_DUMP_FORMAT_VALUE24_TIMING_DELTA,
TRACE_DUMP_FORMAT_POINT
};
#endif
/* currently divided as follows:*/
#if (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 3)
......@@ -192,65 +152,32 @@ enum TRACE_DUMP_FORMAT {
#define TRACE_SP0_HEADER_ADDR (TRACE_SP0_ADDR)
#define TRACE_SP0_HEADER_SIZE (sizeof(struct trace_header_t))
#ifndef ISP2401
#define TRACE_SP0_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_SP0_DATA_ADDR (TRACE_SP0_HEADER_ADDR + TRACE_SP0_HEADER_SIZE)
#define TRACE_SP0_DATA_SIZE (TRACE_SP0_SIZE - TRACE_SP0_HEADER_SIZE)
#define TRACE_SP0_MAX_POINTS (TRACE_SP0_DATA_SIZE / TRACE_SP0_ITEM_SIZE)
#else
#define TRACE_SP0_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_SP0_DATA_ADDR (TRACE_SP0_HEADER_ADDR + TRACE_SP0_HEADER_SIZE)
#define TRACE_SP0_DATA_SIZE (TRACE_SP0_SIZE - TRACE_SP0_HEADER_SIZE)
#define TRACE_SP0_MAX_POINTS (TRACE_SP0_DATA_SIZE / TRACE_SP0_ITEM_SIZE)
#endif
#define TRACE_SP1_HEADER_ADDR (TRACE_SP1_ADDR)
#define TRACE_SP1_HEADER_SIZE (sizeof(struct trace_header_t))
#ifndef ISP2401
#define TRACE_SP1_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_SP1_DATA_ADDR (TRACE_SP1_HEADER_ADDR + TRACE_SP1_HEADER_SIZE)
#define TRACE_SP1_DATA_SIZE (TRACE_SP1_SIZE - TRACE_SP1_HEADER_SIZE)
#define TRACE_SP1_MAX_POINTS (TRACE_SP1_DATA_SIZE / TRACE_SP1_ITEM_SIZE)
#else
#define TRACE_SP1_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_SP1_DATA_ADDR (TRACE_SP1_HEADER_ADDR + TRACE_SP1_HEADER_SIZE)
#define TRACE_SP1_DATA_SIZE (TRACE_SP1_SIZE - TRACE_SP1_HEADER_SIZE)
#define TRACE_SP1_MAX_POINTS (TRACE_SP1_DATA_SIZE / TRACE_SP1_ITEM_SIZE)
#endif
#define TRACE_ISP_HEADER_ADDR (TRACE_ISP_ADDR)
#define TRACE_ISP_HEADER_SIZE (sizeof(struct trace_header_t))
#ifndef ISP2401
#define TRACE_ISP_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_ISP_DATA_ADDR (TRACE_ISP_HEADER_ADDR + TRACE_ISP_HEADER_SIZE)
#define TRACE_ISP_DATA_SIZE (TRACE_ISP_SIZE - TRACE_ISP_HEADER_SIZE)
#define TRACE_ISP_MAX_POINTS (TRACE_ISP_DATA_SIZE / TRACE_ISP_ITEM_SIZE)
#else
#define TRACE_ISP_ITEM_SIZE (sizeof(struct trace_item_t))
#define TRACE_ISP_DATA_ADDR (TRACE_ISP_HEADER_ADDR + TRACE_ISP_HEADER_SIZE)
#define TRACE_ISP_DATA_SIZE (TRACE_ISP_SIZE - TRACE_ISP_HEADER_SIZE)
#define TRACE_ISP_MAX_POINTS (TRACE_ISP_DATA_SIZE / TRACE_ISP_ITEM_SIZE)
#endif
#ifndef ISP2401
/* offsets for master_port read/write */
#define HDR_HDR_OFFSET 0 /* offset of the header */
#define HDR_COMMAND_OFFSET 4 /* offset of the command */
#define HDR_DATA_OFFSET 8 /* offset of the command data */
#define HDR_DEBUG_SIGNATURE_OFFSET 16 /* offset of the param debug signature in trace_header_t */
#define HDR_DEBUG_POINTER_OFFSET 20 /* offset of the param debug pointer in trace_header_t */
#endif
/* common majors */
#ifdef ISP2401
/* SP0 */
#endif
#define MAJOR_MAIN 1
#define MAJOR_ISP_STAGE_ENTRY 2
#define MAJOR_DMA_PRXY 3
#define MAJOR_START_ISP 4
#ifdef ISP2401
/* SP1 */
#define MAJOR_OBSERVER_ISP0_EVENT 21
#define MAJOR_OBSERVER_OUTPUT_FORM_EVENT 22
......@@ -260,7 +187,6 @@ enum TRACE_DUMP_FORMAT {
#define MAJOR_OBSERVER_SP_TERMINATE_EVENT 26
#define MAJOR_OBSERVER_DMA_ACK 27
#define MAJOR_OBSERVER_ACC_ACK 28
#endif
#define DEBUG_PTR_SIGNATURE 0xABCD /* signature for the debug parameter pointer */
......@@ -288,39 +214,20 @@ typedef enum {
#define FIELD_VALUE_WIDTH (16)
#define FIELD_VALUE_MASK FIELD_MASK(FIELD_VALUE_WIDTH)
#define FIELD_VALUE_PACK(f) FIELD_PACK(f, FIELD_VALUE_MASK, FIELD_VALUE_OFFSET)
#ifndef ISP2401
#define FIELD_VALUE_UNPACK(f) FIELD_UNPACK(f, FIELD_VALUE_MASK, FIELD_VALUE_OFFSET)
#else
#define FIELD_VALUE_UNPACK(f) FIELD_UNPACK(f, FIELD_VALUE_MASK, FIELD_VALUE_OFFSET)
#endif
#define FIELD_MINOR_OFFSET (FIELD_VALUE_OFFSET + FIELD_VALUE_WIDTH)
#define FIELD_MINOR_WIDTH (8)
#define FIELD_MINOR_MASK FIELD_MASK(FIELD_MINOR_WIDTH)
#define FIELD_MINOR_PACK(f) FIELD_PACK(f, FIELD_MINOR_MASK, FIELD_MINOR_OFFSET)
#ifndef ISP2401
#define FIELD_MINOR_UNPACK(f) FIELD_UNPACK(f, FIELD_MINOR_MASK, FIELD_MINOR_OFFSET)
#else
#define FIELD_MINOR_UNPACK(f) FIELD_UNPACK(f, FIELD_MINOR_MASK, FIELD_MINOR_OFFSET)
#endif
#define FIELD_MAJOR_OFFSET (FIELD_MINOR_OFFSET + FIELD_MINOR_WIDTH)
#define FIELD_MAJOR_WIDTH (5)
#define FIELD_MAJOR_MASK FIELD_MASK(FIELD_MAJOR_WIDTH)
#define FIELD_MAJOR_PACK(f) FIELD_PACK(f, FIELD_MAJOR_MASK, FIELD_MAJOR_OFFSET)
#ifndef ISP2401
#define FIELD_MAJOR_UNPACK(f) FIELD_UNPACK(f, FIELD_MAJOR_MASK, FIELD_MAJOR_OFFSET)
#else
#define FIELD_MAJOR_UNPACK(f) FIELD_UNPACK(f, FIELD_MAJOR_MASK, FIELD_MAJOR_OFFSET)
#endif
#ifndef ISP2401
#define FIELD_FORMAT_OFFSET (FIELD_MAJOR_OFFSET + FIELD_MAJOR_WIDTH)
#define FIELD_FORMAT_WIDTH (3)
#define FIELD_FORMAT_MASK FIELD_MASK(FIELD_FORMAT_WIDTH)
#define FIELD_FORMAT_PACK(f) FIELD_PACK(f, FIELD_FORMAT_MASK, FIELD_FORMAT_OFFSET)
#define FIELD_FORMAT_UNPACK(f) FIELD_UNPACK(f, FIELD_FORMAT_MASK, FIELD_FORMAT_OFFSET)
#else
/* for quick traces - only insertion, compatible with the regular point */
#define FIELD_FULL_MAJOR_WIDTH (8)
#define FIELD_FULL_MAJOR_MASK FIELD_MASK(FIELD_FULL_MAJOR_WIDTH)
......@@ -349,22 +256,13 @@ typedef enum {
#define FIELD_TID_MASK FIELD_MASK(FIELD_TID_WIDTH)
#define FIELD_TID_PACK(f) FIELD_PACK(f, FIELD_TID_MASK, FIELD_TID_OFFSET)
#define FIELD_TID_UNPACK(f) FIELD_UNPACK(f, FIELD_TID_MASK, FIELD_TID_OFFSET)
#endif
#define FIELD_VALUE_24_OFFSET (0)
#define FIELD_VALUE_24_WIDTH (24)
#ifndef ISP2401
#define FIELD_VALUE_24_MASK FIELD_MASK(FIELD_VALUE_24_WIDTH)
#else
#define FIELD_VALUE_24_MASK FIELD_MASK(FIELD_VALUE_24_WIDTH)
#endif
#define FIELD_VALUE_24_PACK(f) FIELD_PACK(f, FIELD_VALUE_24_MASK, FIELD_VALUE_24_OFFSET)
#define FIELD_VALUE_24_UNPACK(f) FIELD_UNPACK(f, FIELD_VALUE_24_MASK, FIELD_VALUE_24_OFFSET)
#ifndef ISP2401
#define PACK_TRACEPOINT(format, major, minor, value) \
(FIELD_FORMAT_PACK(format) | FIELD_MAJOR_PACK(major) | FIELD_MINOR_PACK(minor) | FIELD_VALUE_PACK(value))
#else
#define PACK_TRACEPOINT(tid, major, minor, value) \
(FIELD_TID_PACK(tid) | FIELD_MAJOR_PACK(major) | FIELD_MINOR_PACK(minor) | FIELD_VALUE_PACK(value))
......@@ -373,14 +271,8 @@ typedef enum {
#define PACK_FORMATTED_TRACEPOINT(format, major, minor, value) \
(FIELD_TID_PACK(FIELD_TID_SEL_FORMAT_PAT) | FIELD_FORMAT_PACK(format) | FIELD_MAJOR_PACK(major) | FIELD_MINOR_PACK(minor) | FIELD_VALUE_PACK(value))
#endif
#ifndef ISP2401
#define PACK_TRACE_VALUE24(format, major, value) \
(FIELD_FORMAT_PACK(format) | FIELD_MAJOR_PACK(major) | FIELD_VALUE_24_PACK(value))
#else
#define PACK_TRACE_VALUE24(major, value) \
(FIELD_TID_PACK(FIELD_TID_SEL_FORMAT_PAT) | FIELD_MAJOR_PACK(major) | FIELD_VALUE_24_PACK(value))
#endif
#endif /* __CSS_TRACE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment