Commit | Line | Data |
---|---|---|
96a9a934 PSJ |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* Copyright (C) 2022, Intel Corporation. */ | |
3 | ||
4 | #ifndef _ICE_FWLOG_H_ | |
5 | #define _ICE_FWLOG_H_ | |
6 | #include "ice_adminq_cmd.h" | |
7 | ||
8 | struct ice_hw; | |
9 | ||
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) | |
13 | */ | |
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 */ | |
21 | }; | |
22 | ||
23 | struct ice_fwlog_module_entry { | |
24 | /* module ID for the corresponding firmware logging event */ | |
25 | u16 module_id; | |
26 | /* verbosity level for the module_id */ | |
27 | u8 log_level; | |
28 | }; | |
29 | ||
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 */ | |
34 | u16 options; | |
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 | |
39 | */ | |
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 | |
43 | */ | |
44 | #define ICE_FWLOG_OPTION_IS_REGISTERED BIT(3) | |
45 | ||
46 | /* minimum number of log events sent per Admin Receive Queue event */ | |
47 | u16 log_resolution; | |
48 | }; | |
49 | ||
9d3535e7 PSJ |
50 | struct ice_fwlog_data { |
51 | u16 data_size; | |
52 | u8 *data; | |
53 | }; | |
54 | ||
55 | struct ice_fwlog_ring { | |
56 | struct ice_fwlog_data *rings; | |
57 | u16 index; | |
58 | u16 size; | |
59 | u16 head; | |
60 | u16 tail; | |
61 | }; | |
62 | ||
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 | |
66 | ||
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); | |
96a9a934 PSJ |
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); | |
73671c31 PSJ |
76 | int ice_fwlog_register(struct ice_hw *hw); |
77 | int ice_fwlog_unregister(struct ice_hw *hw); | |
9d3535e7 | 78 | void ice_fwlog_realloc_rings(struct ice_hw *hw, int index); |
96a9a934 | 79 | #endif /* _ICE_FWLOG_H_ */ |