linux/drivers/staging/media/atomisp/pci/css_trace.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __CSS_TRACE_H_
#define __CSS_TRACE_H_

#include <type_support.h>
#include "sh_css_internal.h"	/* for SH_CSS_MAX_SP_THREADS */

/*
	structs and constants for tracing
*/

/* one tracer item: major, minor and counter. The counter value can be used for GP data */
struct trace_item_t {};

#define MAX_SCRATCH_DATA
#define MAX_CMD_DATA

/* trace header: holds the version and the topology of the tracer. */
struct trace_header_t {};

/* offsets for master_port read/write */
#define HDR_HDR_OFFSET
#define HDR_COMMAND_OFFSET
#define HDR_DATA_OFFSET
#define HDR_DEBUG_SIGNATURE_OFFSET
#define HDR_DEBUG_POINTER_OFFSET
#define HDR_STATUS_OFFSET
#define HDR_STATUS_OFFSET_BYTE
#define HDR_STATUS_OFFSET_WORD
#define HDR_STATUS_OFFSET_DWORD
#define HDR_STATUS_OFFSET_SCRATCH

/*
Trace version history:
 1: initial version, hdr = descr, command & ptr.
 2: added ISP + 24-bit fields.
 3: added thread ID.
 4: added status in header.
*/
#define TRACER_VER

#define TRACE_BUFF_ADDR
#define TRACE_BUFF_SIZE

#define TRACE_ENABLE_SP0
#define TRACE_ENABLE_SP1
#define TRACE_ENABLE_ISP

enum TRACE_CORE_ID {};

/* TODO: add timing format? */
enum TRACE_DUMP_FORMAT {};

/* currently divided as follows:*/
#if (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 3)
/* can be divided as needed */
#define TRACE_SP0_SIZE
#define TRACE_SP1_SIZE
#define TRACE_ISP_SIZE
#elif (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 2)
#if TRACE_ENABLE_SP0
#define TRACE_SP0_SIZE
#else
#define TRACE_SP0_SIZE
#endif
#if TRACE_ENABLE_SP1
#define TRACE_SP1_SIZE
#else
#define TRACE_SP1_SIZE
#endif
#if TRACE_ENABLE_ISP
#define TRACE_ISP_SIZE
#else
#define TRACE_ISP_SIZE
#endif
#elif (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 1)
#if TRACE_ENABLE_SP0
#define TRACE_SP0_SIZE
#else
#define TRACE_SP0_SIZE
#endif
#if TRACE_ENABLE_SP1
#define TRACE_SP1_SIZE
#else
#define TRACE_SP1_SIZE
#endif
#if TRACE_ENABLE_ISP
#define TRACE_ISP_SIZE
#else
#define TRACE_ISP_SIZE
#endif
#else
#define TRACE_SP0_SIZE
#define TRACE_SP1_SIZE
#define TRACE_ISP_SIZE
#endif

#define TRACE_SP0_ADDR
#define TRACE_SP1_ADDR
#define TRACE_ISP_ADDR

/* check if it's a legal division */
#if (TRACE_BUFF_SIZE < TRACE_SP0_SIZE + TRACE_SP1_SIZE + TRACE_ISP_SIZE)
#error trace sizes are not divided correctly and are above limit
#endif

#define TRACE_SP0_HEADER_ADDR
#define TRACE_SP0_HEADER_SIZE
#define TRACE_SP0_ITEM_SIZE
#define TRACE_SP0_DATA_ADDR
#define TRACE_SP0_DATA_SIZE
#define TRACE_SP0_MAX_POINTS

#define TRACE_SP1_HEADER_ADDR
#define TRACE_SP1_HEADER_SIZE
#define TRACE_SP1_ITEM_SIZE
#define TRACE_SP1_DATA_ADDR
#define TRACE_SP1_DATA_SIZE
#define TRACE_SP1_MAX_POINTS

#define TRACE_ISP_HEADER_ADDR
#define TRACE_ISP_HEADER_SIZE
#define TRACE_ISP_ITEM_SIZE
#define TRACE_ISP_DATA_ADDR
#define TRACE_ISP_DATA_SIZE
#define TRACE_ISP_MAX_POINTS

/* common majors */
/* SP0 */
#define MAJOR_MAIN
#define MAJOR_ISP_STAGE_ENTRY
#define MAJOR_DMA_PRXY
#define MAJOR_START_ISP
/* SP1 */
#define MAJOR_OBSERVER_ISP0_EVENT
#define MAJOR_OBSERVER_OUTPUT_FORM_EVENT
#define MAJOR_OBSERVER_OUTPUT_SCAL_EVENT
#define MAJOR_OBSERVER_IF_ACK
#define MAJOR_OBSERVER_SP0_EVENT
#define MAJOR_OBSERVER_SP_TERMINATE_EVENT
#define MAJOR_OBSERVER_DMA_ACK
#define MAJOR_OBSERVER_ACC_ACK

#define DEBUG_PTR_SIGNATURE

/* command codes (1st byte) */
DBG_commands;

/* command signature */
#define CMD_SIGNATURE

/* shared macros in traces infrastructure */
/* increment the pointer cyclicly */
#define DBG_NEXT_ITEM(x, max_items)
#define DBG_PREV_ITEM(x, max_items)

#define FIELD_MASK(width)
#define FIELD_PACK(value, mask, offset)
#define FIELD_UNPACK(value, mask, offset)

#define FIELD_VALUE_OFFSET
#define FIELD_VALUE_WIDTH
#define FIELD_VALUE_MASK
#define FIELD_VALUE_PACK(f)
#define FIELD_VALUE_UNPACK(f)

#define FIELD_MINOR_OFFSET
#define FIELD_MINOR_WIDTH
#define FIELD_MINOR_MASK
#define FIELD_MINOR_PACK(f)
#define FIELD_MINOR_UNPACK(f)

#define FIELD_MAJOR_OFFSET
#define FIELD_MAJOR_WIDTH
#define FIELD_MAJOR_MASK
#define FIELD_MAJOR_PACK(f)
#define FIELD_MAJOR_UNPACK(f)

/* for quick traces - only insertion, compatible with the regular point */
#define FIELD_FULL_MAJOR_WIDTH
#define FIELD_FULL_MAJOR_MASK
#define FIELD_FULL_MAJOR_PACK(f)

/* The following 2 fields are used only when FIELD_TID value is 111b.
 * it means we don't want to use thread id, but format. In this case,
 * the last 2 MSB bits of the major field will indicates the format
 */
#define FIELD_MAJOR_W_FMT_OFFSET
#define FIELD_MAJOR_W_FMT_WIDTH
#define FIELD_MAJOR_W_FMT_MASK
#define FIELD_MAJOR_W_FMT_PACK(f)
#define FIELD_MAJOR_W_FMT_UNPACK(f)

#define FIELD_FORMAT_OFFSET
#define FIELD_FORMAT_WIDTH
#define FIELD_FORMAT_MASK
#define FIELD_FORMAT_PACK(f)
#define FIELD_FORMAT_UNPACK(f)

#define FIELD_TID_SEL_FORMAT_PAT

#define FIELD_TID_OFFSET
#define FIELD_TID_WIDTH
#define FIELD_TID_MASK
#define FIELD_TID_PACK(f)
#define FIELD_TID_UNPACK(f)

#define FIELD_VALUE_24_OFFSET
#define FIELD_VALUE_24_WIDTH
#define FIELD_VALUE_24_MASK
#define FIELD_VALUE_24_PACK(f)
#define FIELD_VALUE_24_UNPACK(f)

#define PACK_TRACEPOINT(tid, major, minor, value)

#define PACK_QUICK_TRACEPOINT(major, minor)

#define PACK_FORMATTED_TRACEPOINT(format, major, minor, value)

#define PACK_TRACE_VALUE24(major, value)

#endif /* __CSS_TRACE_H_ */