Once logging is enabled the user should read the data from the 'data' file. The data is in the form of a binary blob that can be sent to Intel for decoding. To read the data use a command like: # cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/data > log_data.bin If the user wants to clear the FW log data that has been stored in the driver then they can write any value to the 'data' file and that will clear the data. An example is: # echo 34 > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/data In addition to being able to read the data the user can configure how much memory is used to store FW log data. This allows the user to increase/decrease the amount of memory based on the users situation. The data is stored such that if the memory fills up then the oldest data will get overwritten in a circular manner. To change the amount of memory the user can write to the 'log_size' file like this: # echo <value> > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/log_size Where <value> is one of 128K, 256K, 512K, 1M, and 2M. The default value is 1M. The user can see the current value of 'log_size' by reading the file: # cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/log_size Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
79 lines
2.4 KiB
C
79 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2022, Intel Corporation. */
|
|
|
|
#ifndef _ICE_FWLOG_H_
|
|
#define _ICE_FWLOG_H_
|
|
#include "ice_adminq_cmd.h"
|
|
|
|
struct ice_hw;
|
|
|
|
/* Only a single log level should be set and all log levels under the set value
|
|
* are enabled, e.g. if log level is set to ICE_FW_LOG_LEVEL_VERBOSE, then all
|
|
* other log levels are included (except ICE_FW_LOG_LEVEL_NONE)
|
|
*/
|
|
enum ice_fwlog_level {
|
|
ICE_FWLOG_LEVEL_NONE = 0,
|
|
ICE_FWLOG_LEVEL_ERROR = 1,
|
|
ICE_FWLOG_LEVEL_WARNING = 2,
|
|
ICE_FWLOG_LEVEL_NORMAL = 3,
|
|
ICE_FWLOG_LEVEL_VERBOSE = 4,
|
|
ICE_FWLOG_LEVEL_INVALID, /* all values >= this entry are invalid */
|
|
};
|
|
|
|
struct ice_fwlog_module_entry {
|
|
/* module ID for the corresponding firmware logging event */
|
|
u16 module_id;
|
|
/* verbosity level for the module_id */
|
|
u8 log_level;
|
|
};
|
|
|
|
struct ice_fwlog_cfg {
|
|
/* list of modules for configuring log level */
|
|
struct ice_fwlog_module_entry module_entries[ICE_AQC_FW_LOG_ID_MAX];
|
|
/* options used to configure firmware logging */
|
|
u16 options;
|
|
#define ICE_FWLOG_OPTION_ARQ_ENA BIT(0)
|
|
#define ICE_FWLOG_OPTION_UART_ENA BIT(1)
|
|
/* set before calling ice_fwlog_init() so the PF registers for firmware
|
|
* logging on initialization
|
|
*/
|
|
#define ICE_FWLOG_OPTION_REGISTER_ON_INIT BIT(2)
|
|
/* set in the ice_fwlog_get() response if the PF is registered for FW
|
|
* logging events over ARQ
|
|
*/
|
|
#define ICE_FWLOG_OPTION_IS_REGISTERED BIT(3)
|
|
|
|
/* minimum number of log events sent per Admin Receive Queue event */
|
|
u16 log_resolution;
|
|
};
|
|
|
|
struct ice_fwlog_data {
|
|
u16 data_size;
|
|
u8 *data;
|
|
};
|
|
|
|
struct ice_fwlog_ring {
|
|
struct ice_fwlog_data *rings;
|
|
u16 index;
|
|
u16 size;
|
|
u16 head;
|
|
u16 tail;
|
|
};
|
|
|
|
#define ICE_FWLOG_RING_SIZE_INDEX_DFLT 3
|
|
#define ICE_FWLOG_RING_SIZE_DFLT 256
|
|
#define ICE_FWLOG_RING_SIZE_MAX 512
|
|
|
|
bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings);
|
|
bool ice_fwlog_ring_empty(struct ice_fwlog_ring *rings);
|
|
void ice_fwlog_ring_increment(u16 *item, u16 size);
|
|
void ice_fwlog_set_supported(struct ice_hw *hw);
|
|
bool ice_fwlog_supported(struct ice_hw *hw);
|
|
int ice_fwlog_init(struct ice_hw *hw);
|
|
void ice_fwlog_deinit(struct ice_hw *hw);
|
|
int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
|
|
int ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
|
|
int ice_fwlog_register(struct ice_hw *hw);
|
|
int ice_fwlog_unregister(struct ice_hw *hw);
|
|
void ice_fwlog_realloc_rings(struct ice_hw *hw, int index);
|
|
#endif /* _ICE_FWLOG_H_ */
|