1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2022, Intel Corporation. */
6 #include "ice_adminq_cmd.h"
10 /* Only a single log level should be set and all log levels under the set value
11 * are enabled, e.g. if log level is set to ICE_FW_LOG_LEVEL_VERBOSE, then all
12 * other log levels are included (except ICE_FW_LOG_LEVEL_NONE)
14 enum ice_fwlog_level {
15 ICE_FWLOG_LEVEL_NONE = 0,
16 ICE_FWLOG_LEVEL_ERROR = 1,
17 ICE_FWLOG_LEVEL_WARNING = 2,
18 ICE_FWLOG_LEVEL_NORMAL = 3,
19 ICE_FWLOG_LEVEL_VERBOSE = 4,
20 ICE_FWLOG_LEVEL_INVALID, /* all values >= this entry are invalid */
23 struct ice_fwlog_module_entry {
24 /* module ID for the corresponding firmware logging event */
26 /* verbosity level for the module_id */
30 struct ice_fwlog_cfg {
31 /* list of modules for configuring log level */
32 struct ice_fwlog_module_entry module_entries[ICE_AQC_FW_LOG_ID_MAX];
33 /* options used to configure firmware logging */
35 #define ICE_FWLOG_OPTION_ARQ_ENA BIT(0)
36 #define ICE_FWLOG_OPTION_UART_ENA BIT(1)
37 /* set before calling ice_fwlog_init() so the PF registers for firmware
38 * logging on initialization
40 #define ICE_FWLOG_OPTION_REGISTER_ON_INIT BIT(2)
41 /* set in the ice_fwlog_get() response if the PF is registered for FW
42 * logging events over ARQ
44 #define ICE_FWLOG_OPTION_IS_REGISTERED BIT(3)
46 /* minimum number of log events sent per Admin Receive Queue event */
50 struct ice_fwlog_data {
55 struct ice_fwlog_ring {
56 struct ice_fwlog_data *rings;
63 #define ICE_FWLOG_RING_SIZE_INDEX_DFLT 3
64 #define ICE_FWLOG_RING_SIZE_DFLT 256
65 #define ICE_FWLOG_RING_SIZE_MAX 512
67 bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings);
68 bool ice_fwlog_ring_empty(struct ice_fwlog_ring *rings);
69 void ice_fwlog_ring_increment(u16 *item, u16 size);
70 void ice_fwlog_set_supported(struct ice_hw *hw);
71 bool ice_fwlog_supported(struct ice_hw *hw);
72 int ice_fwlog_init(struct ice_hw *hw);
73 void ice_fwlog_deinit(struct ice_hw *hw);
74 int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
75 int ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
76 int ice_fwlog_register(struct ice_hw *hw);
77 int ice_fwlog_unregister(struct ice_hw *hw);
78 void ice_fwlog_realloc_rings(struct ice_hw *hw, int index);
79 #endif /* _ICE_FWLOG_H_ */