linux/sound/soc/sof/ipc4-mtrace.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2022 Intel Corporation

#include <linux/debugfs.h>
#include <linux/sched/signal.h>
#include <linux/sched/clock.h>
#include <sound/sof/ipc4/header.h>
#include "sof-priv.h"
#include "ipc4-priv.h"

/*
 * debug info window is organized in 16 (equal sized) pages:
 *
 *	------------------------
 *	| Page0  - descriptors |
 *	------------------------
 *	| Page1  - slot0       |
 *	------------------------
 *	| Page2  - slot1       |
 *	------------------------
 *	|         ...          |
 *	------------------------
 *	| Page14  - slot13     |
 *	------------------------
 *	| Page15  - slot14     |
 *	------------------------
 *
 * The slot size == page size
 *
 * The first page contains descriptors for the remaining 15 cores
 * The slot descriptor is:
 * u32 res_id;
 * u32 type;
 * u32 vma;
 *
 * Log buffer slots have the following layout:
 * u32 host_read_ptr;
 * u32 dsp_write_ptr;
 * u8 buffer[];
 *
 * The two pointers are offsets within the buffer.
 */

#define FW_EPOCH_DELTA

#define MAX_ALLOWED_LIBRARIES

#define SOF_IPC4_INVALID_SLOT_OFFSET

 /* for debug and critical types */
#define SOF_MTRACE_SLOT_CORE_MASK
#define SOF_MTRACE_SLOT_TYPE_MASK

#define DEFAULT_AGING_TIMER_PERIOD_MS
#define DEFAULT_FIFO_FULL_TIMER_PERIOD_MS

/* ipc4 log level and source definitions for logs_priorities_mask */
#define SOF_MTRACE_LOG_LEVEL_CRITICAL
#define SOF_MTRACE_LOG_LEVEL_ERROR
#define SOF_MTRACE_LOG_LEVEL_WARNING
#define SOF_MTRACE_LOG_LEVEL_INFO
#define SOF_MTRACE_LOG_LEVEL_VERBOSE
#define SOF_MTRACE_LOG_SOURCE_INFRA
#define SOF_MTRACE_LOG_SOURCE_HAL
#define SOF_MTRACE_LOG_SOURCE_MODULE
#define SOF_MTRACE_LOG_SOURCE_AUDIO
#define SOF_MTRACE_LOG_SOURCE_SCHEDULER
#define SOF_MTRACE_LOG_SOURCE_ULP_INFRA
#define SOF_MTRACE_LOG_SOURCE_ULP_MODULE
#define SOF_MTRACE_LOG_SOURCE_VISION
#define DEFAULT_LOGS_PRIORITIES_MASK

struct sof_log_state_info {} __packed;

enum sof_mtrace_state {};

struct sof_mtrace_core_data {};

struct sof_mtrace_priv {};

static int sof_ipc4_mtrace_dfs_open(struct inode *inode, struct file *file)
{}

static bool sof_wait_mtrace_avail(struct sof_mtrace_core_data *core_data)
{}

static ssize_t sof_ipc4_mtrace_dfs_read(struct file *file, char __user *buffer,
					size_t count, loff_t *ppos)
{}

static int sof_ipc4_mtrace_dfs_release(struct inode *inode, struct file *file)
{}

static const struct file_operations sof_dfs_mtrace_fops =;

static ssize_t sof_ipc4_priority_mask_dfs_read(struct file *file, char __user *to,
					       size_t count, loff_t *ppos)
{}

static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
						const char __user *from,
						size_t count, loff_t *ppos)
{}

static const struct file_operations sof_dfs_priority_mask_fops =;

static int mtrace_debugfs_create(struct snd_sof_dev *sdev)
{}

static int ipc4_mtrace_enable(struct snd_sof_dev *sdev)
{}

static void ipc4_mtrace_disable(struct snd_sof_dev *sdev)
{}

/*
 * Each DSP core logs to a dedicated slot.
 * Parse the slot descriptors at debug_box offset to find the debug log slots
 * and map them to cores.
 * There are 15 slots and therefore 15 descriptors to check (MAX_MTRACE_SLOTS)
 */
static void sof_mtrace_find_core_slots(struct snd_sof_dev *sdev)
{}

static int ipc4_mtrace_init(struct snd_sof_dev *sdev)
{}

static void ipc4_mtrace_free(struct snd_sof_dev *sdev)
{}

static int sof_ipc4_mtrace_update_pos_all_cores(struct snd_sof_dev *sdev)
{}

int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core)
{}

static void ipc4_mtrace_fw_crashed(struct snd_sof_dev *sdev)
{}

static int ipc4_mtrace_resume(struct snd_sof_dev *sdev)
{}

static void ipc4_mtrace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state)
{}

const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops =;