Lines Matching +full:fw +full:- +full:cfg
1 /* SPDX-License-Identifier: BSD-3-Clause */
37 * cache_cfg - Cache FW logging config
39 * @cfg: config to cache
41 static void cache_cfg(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
43 hw->fwlog_cfg = *cfg;
47 * valid_module_entries - validate all the module entry IDs and log levels
64 ice_debug(hw, ICE_DBG_FW_LOG, "num_entries must be non-zero\n");
71 if (entry->module_id >= ICE_AQC_FW_LOG_ID_MAX) {
73 entry->module_id, ICE_AQC_FW_LOG_ID_MAX - 1);
77 if (entry->log_level >= ICE_FWLOG_LEVEL_INVALID) {
79 entry->log_level,
80 ICE_AQC_FW_LOG_ID_MAX - 1);
89 * valid_cfg - validate entire configuration
91 * @cfg: config to validate
93 static bool valid_cfg(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
95 if (!cfg) {
100 if (cfg->log_resolution < ICE_AQC_FW_LOG_MIN_RESOLUTION ||
101 cfg->log_resolution > ICE_AQC_FW_LOG_MAX_RESOLUTION) {
103 cfg->log_resolution, ICE_AQC_FW_LOG_MIN_RESOLUTION,
108 if (!valid_module_entries(hw, cfg->module_entries,
116 * ice_fwlog_init - Initialize cached structures for tracking FW logging
118 * @cfg: config used to initialize the cached structures
125 ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
127 if (!valid_cfg(hw, cfg))
130 cache_cfg(hw, cfg);
136 * ice_aq_fwlog_set - Set FW logging configuration AQ command (0xFF30)
140 * @options: options from ice_fwlog_cfg->options structure
169 cmd->cmd_flags = ICE_AQC_FW_LOG_CONF_SET_VALID;
170 cmd->ops.cfg.log_resolution = CPU_TO_LE16(log_resolution);
171 cmd->ops.cfg.mdl_cnt = CPU_TO_LE16(num_entries);
174 cmd->cmd_flags |= ICE_AQC_FW_LOG_CONF_AQ_EN;
176 cmd->cmd_flags |= ICE_AQC_FW_LOG_CONF_UART_EN;
188 * ice_fwlog_supported - Cached for whether FW supports FW logging or not
196 return hw->fwlog_support_ena;
200 * ice_fwlog_set - Set the firmware logging settings
202 * @cfg: config used to set firmware logging
208 * If the PF wishes to receive FW logging then it must register via
213 ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
220 if (!valid_cfg(hw, cfg))
223 status = ice_aq_fwlog_set(hw, cfg->module_entries,
224 ICE_AQC_FW_LOG_ID_MAX, cfg->options,
225 cfg->log_resolution);
227 cache_cfg(hw, cfg);
233 * update_cached_entries - Update module entries in cached FW logging config
250 &hw->fwlog_cfg.module_entries[j];
252 if (cached->module_id == updated->module_id) {
253 cached->log_level = updated->log_level;
261 * ice_fwlog_update_modules - Update the log level 1 or more FW logging modules
266 * This function should be called to update the log level of 1 or more FW
277 struct ice_fwlog_cfg *cfg;
286 cfg = (struct ice_fwlog_cfg *)ice_calloc(hw, 1, sizeof(*cfg));
287 if (!cfg)
290 status = ice_fwlog_get(hw, cfg);
294 status = ice_aq_fwlog_set(hw, entries, num_entries, cfg->options,
295 cfg->log_resolution);
300 ice_free(hw, cfg);
305 * ice_aq_fwlog_register - Register PF for firmware logging events (0xFF31)
322 * ice_fwlog_register - Register the PF for firmware logging
339 hw->fwlog_cfg.options |= ICE_FWLOG_OPTION_IS_REGISTERED;
345 * ice_fwlog_unregister - Unregister the PF from firmware logging
359 hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_IS_REGISTERED;
365 * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32)
367 * @cfg: firmware logging configuration to populate
370 ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
379 ice_memset(cfg, 0, sizeof(*cfg), ICE_NONDMA_MEM);
388 cmd->cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY;
392 ice_debug(hw, ICE_DBG_FW_LOG, "Failed to get FW log configuration\n");
396 module_id_cnt = LE16_TO_CPU(cmd->ops.cfg.mdl_cnt);
398 ice_debug(hw, ICE_DBG_FW_LOG, "FW returned less than the expected number of FW log module IDs\n");
401 ice_debug(hw, ICE_DBG_FW_LOG, "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n",
406 cfg->log_resolution = LE16_TO_CPU(cmd->ops.cfg.log_resolution);
407 if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_AQ_EN)
408 cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA;
409 if (cmd->cmd_flags & ICE_AQC_FW_LOG_CONF_UART_EN)
410 cfg->options |= ICE_FWLOG_OPTION_UART_ENA;
411 if (cmd->cmd_flags & ICE_AQC_FW_LOG_QUERY_REGISTERED)
412 cfg->options |= ICE_FWLOG_OPTION_IS_REGISTERED;
419 cfg->module_entries[i].module_id =
420 LE16_TO_CPU(fw_module->module_identifier);
421 cfg->module_entries[i].log_level = fw_module->log_level;
430 * ice_fwlog_set_support_ena - Set if FW logging is supported by FW
433 * If FW returns success to the ice_aq_fwlog_get call then it supports FW
437 * the FW support FW logging.
441 struct ice_fwlog_cfg *cfg;
444 hw->fwlog_support_ena = false;
446 cfg = (struct ice_fwlog_cfg *)ice_calloc(hw, 1, sizeof(*cfg));
447 if (!cfg)
454 status = ice_aq_fwlog_get(hw, cfg);
456 ice_debug(hw, ICE_DBG_FW_LOG, "ice_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n",
459 hw->fwlog_support_ena = true;
461 ice_free(hw, cfg);
465 * ice_fwlog_get - Get the firmware logging settings
467 * @cfg: config to populate based on current firmware logging settings
470 ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
477 if (!cfg)
480 status = ice_aq_fwlog_get(hw, cfg);
484 cache_cfg(hw, cfg);
490 * ice_fwlog_event_dump - Dump the event received over the Admin Receive Queue
493 * @buf: buffer that contains the FW log event data
496 * Queue, then it should call this function to dump the FW log data.
504 ice_info_fwlog(hw, 32, 1, (u8 *)buf, LE16_TO_CPU(desc->datalen));