// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022, Intel Corporation. */ #include <linux/fs.h> #include <linux/debugfs.h> #include <linux/random.h> #include <linux/vmalloc.h> #include "ice.h" static struct dentry *ice_debugfs_root; /* create a define that has an extra module that doesn't really exist. this * is so we can add a module 'all' to easily enable/disable all the modules */ #define ICE_NR_FW_LOG_MODULES … /* the ordering in this array is important. it matches the ordering of the * values in the FW so the index is the same value as in ice_aqc_fw_logging_mod */ static const char * const ice_fwlog_module_string[] = …; /* the ordering in this array is important. it matches the ordering of the * values in the FW so the index is the same value as in ice_fwlog_level */ static const char * const ice_fwlog_level_string[] = …; static const char * const ice_fwlog_log_size[] = …; /** * ice_fwlog_print_module_cfg - print current FW logging module configuration * @hw: pointer to the HW structure * @module: module to print * @s: the seq file to put data into */ static void ice_fwlog_print_module_cfg(struct ice_hw *hw, int module, struct seq_file *s) { … } static int ice_find_module_by_dentry(struct ice_pf *pf, struct dentry *d) { … } /** * ice_debugfs_module_show - read from 'module' file * @s: the opened file * @v: pointer to the offset */ static int ice_debugfs_module_show(struct seq_file *s, void *v) { … } static int ice_debugfs_module_open(struct inode *inode, struct file *filp) { … } /** * ice_debugfs_module_write - write into 'module' file * @filp: the opened file * @buf: where to find the user's data * @count: the length of the user's data * @ppos: file position offset */ static ssize_t ice_debugfs_module_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { … } static const struct file_operations ice_debugfs_module_fops = …; /** * ice_debugfs_nr_messages_read - read from 'nr_messages' file * @filp: the opened file * @buffer: where to write the data for the user to read * @count: the size of the user's buffer * @ppos: file position offset */ static ssize_t ice_debugfs_nr_messages_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } /** * ice_debugfs_nr_messages_write - write into 'nr_messages' file * @filp: the opened file * @buf: where to find the user's data * @count: the length of the user's data * @ppos: file position offset */ static ssize_t ice_debugfs_nr_messages_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { … } static const struct file_operations ice_debugfs_nr_messages_fops = …; /** * ice_debugfs_enable_read - read from 'enable' file * @filp: the opened file * @buffer: where to write the data for the user to read * @count: the size of the user's buffer * @ppos: file position offset */ static ssize_t ice_debugfs_enable_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } /** * ice_debugfs_enable_write - write into 'enable' file * @filp: the opened file * @buf: where to find the user's data * @count: the length of the user's data * @ppos: file position offset */ static ssize_t ice_debugfs_enable_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { … } static const struct file_operations ice_debugfs_enable_fops = …; /** * ice_debugfs_log_size_read - read from 'log_size' file * @filp: the opened file * @buffer: where to write the data for the user to read * @count: the size of the user's buffer * @ppos: file position offset */ static ssize_t ice_debugfs_log_size_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } /** * ice_debugfs_log_size_write - write into 'log_size' file * @filp: the opened file * @buf: where to find the user's data * @count: the length of the user's data * @ppos: file position offset */ static ssize_t ice_debugfs_log_size_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { … } static const struct file_operations ice_debugfs_log_size_fops = …; /** * ice_debugfs_data_read - read from 'data' file * @filp: the opened file * @buffer: where to write the data for the user to read * @count: the size of the user's buffer * @ppos: file position offset */ static ssize_t ice_debugfs_data_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } /** * ice_debugfs_data_write - write into 'data' file * @filp: the opened file * @buf: where to find the user's data * @count: the length of the user's data * @ppos: file position offset */ static ssize_t ice_debugfs_data_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { … } static const struct file_operations ice_debugfs_data_fops = …; /** * ice_debugfs_fwlog_init - setup the debugfs directory * @pf: the ice that is starting up */ void ice_debugfs_fwlog_init(struct ice_pf *pf) { … } /** * ice_debugfs_pf_deinit - cleanup PF's debugfs * @pf: pointer to the PF struct */ void ice_debugfs_pf_deinit(struct ice_pf *pf) { … } /** * ice_debugfs_init - create root directory for debugfs entries */ void ice_debugfs_init(void) { … } /** * ice_debugfs_exit - remove debugfs entries */ void ice_debugfs_exit(void) { … }