#define ICE_FWLOG_INDEX_TO_BYTES(n) ((128 * 1024) << (n))
/**
* ice_fwlog_realloc_rings - reallocate the FW log rings
- * @hw: pointer to the HW structure
* @fwlog: pointer to the fwlog structure
* @index: the new index to use to allocate memory for the log data
*
*/
-void ice_fwlog_realloc_rings(struct ice_hw *hw, struct ice_fwlog *fwlog,
- int index)
+void ice_fwlog_realloc_rings(struct ice_fwlog *fwlog, int index)
{
struct ice_fwlog_ring ring;
int status, ring_size;
status = ice_fwlog_alloc_ring_buffs(&ring);
if (status) {
- dev_warn(ice_hw_to_dev(hw), "Unable to allocate memory for FW log ring data buffers\n");
+ dev_warn(&fwlog->pdev->dev, "Unable to allocate memory for FW log ring data buffers\n");
ice_fwlog_free_ring_buffs(&ring);
kfree(ring.rings);
return;
status = ice_aq_send_cmd(hw, &desc, buf, ICE_AQ_MAX_BUF_LEN, NULL);
if (status) {
- ice_debug(hw, ICE_DBG_FW_LOG, "Failed to get FW log configuration\n");
+ dev_dbg(&hw->fwlog.pdev->dev, "Failed to get FW log configuration\n");
goto status_out;
}
module_id_cnt = le16_to_cpu(cmd->ops.cfg.mdl_cnt);
if (module_id_cnt < ICE_AQC_FW_LOG_ID_MAX) {
- ice_debug(hw, ICE_DBG_FW_LOG, "FW returned less than the expected number of FW log module IDs\n");
+ dev_dbg(&hw->fwlog.pdev->dev, "FW returned less than the expected number of FW log module IDs\n");
} else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX) {
- 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",
- ICE_AQC_FW_LOG_ID_MAX);
+ dev_dbg(&hw->fwlog.pdev->dev, "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n",
+ ICE_AQC_FW_LOG_ID_MAX);
module_id_cnt = ICE_AQC_FW_LOG_ID_MAX;
}
status = ice_aq_fwlog_get(hw, cfg);
if (status)
- ice_debug(hw, ICE_DBG_FW_LOG, "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n",
- status);
+ dev_dbg(&fwlog->pdev->dev, "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n",
+ status);
else
fwlog->supported = true;
* ice_fwlog_init - Initialize FW logging configuration
* @hw: pointer to the HW structure
* @fwlog: pointer to the fwlog structure
+ * @pdev: pointer to the pci dev used in dev_warn()
*
* This function should be called on driver initialization during
* ice_init_hw().
*/
-int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog)
+int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog,
+ struct pci_dev *pdev)
{
/* only support fw log commands on PF 0 */
if (hw->bus.func)
return -EINVAL;
ice_fwlog_set_supported(hw, fwlog);
+ fwlog->pdev = pdev;
if (ice_fwlog_supported(fwlog)) {
int status;
sizeof(*fwlog->ring.rings),
GFP_KERNEL);
if (!fwlog->ring.rings) {
- dev_warn(ice_hw_to_dev(hw), "Unable to allocate memory for FW log rings\n");
+ dev_warn(&fwlog->pdev->dev, "Unable to allocate memory for FW log rings\n");
return -ENOMEM;
}
status = ice_fwlog_alloc_ring_buffs(&fwlog->ring);
if (status) {
- dev_warn(ice_hw_to_dev(hw), "Unable to allocate memory for FW log ring data buffers\n");
+ dev_warn(&fwlog->pdev->dev, "Unable to allocate memory for FW log ring data buffers\n");
ice_fwlog_free_ring_buffs(&fwlog->ring);
kfree(fwlog->ring.rings);
return status;
ice_debugfs_fwlog_init(hw->back);
} else {
- dev_warn(ice_hw_to_dev(hw), "FW logging is not supported in this NVM image. Please update the NVM to get FW log support\n");
+ dev_warn(&fwlog->pdev->dev, "FW logging is not supported in this NVM image. Please update the NVM to get FW log support\n");
}
return 0;
fwlog->cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA;
status = ice_fwlog_set(hw, &fwlog->cfg);
if (status)
- dev_warn(ice_hw_to_dev(hw), "Unable to turn off FW logging, status: %d\n",
+ dev_warn(&fwlog->pdev->dev, "Unable to turn off FW logging, status: %d\n",
status);
kfree(pf->ice_debugfs_pf_fwlog_modules);
status = ice_fwlog_unregister(hw, fwlog);
if (status)
- dev_warn(ice_hw_to_dev(hw), "Unable to unregister FW logging, status: %d\n",
+ dev_warn(&fwlog->pdev->dev, "Unable to unregister FW logging, status: %d\n",
status);
if (fwlog->ring.rings) {
status = ice_aq_fwlog_register(hw, true);
if (status)
- ice_debug(hw, ICE_DBG_FW_LOG, "Failed to register for firmware logging events over ARQ\n");
+ dev_dbg(&fwlog->pdev->dev, "Failed to register for firmware logging events over ARQ\n");
else
fwlog->cfg.options |= ICE_FWLOG_OPTION_IS_REGISTERED;
status = ice_aq_fwlog_register(hw, false);
if (status)
- ice_debug(hw, ICE_DBG_FW_LOG, "Failed to unregister from firmware logging events over ARQ\n");
+ dev_dbg(&fwlog->pdev->dev, "Failed to unregister from firmware logging events over ARQ\n");
else
fwlog->cfg.options &= ~ICE_FWLOG_OPTION_IS_REGISTERED;
struct ice_fwlog_cfg cfg;
bool supported; /* does hardware support FW logging? */
struct ice_fwlog_ring ring;
+ struct pci_dev *pdev;
};
bool ice_fwlog_ring_empty(struct ice_fwlog_ring *rings);
void ice_fwlog_ring_increment(u16 *item, u16 size);
-int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog);
+int ice_fwlog_init(struct ice_hw *hw, struct ice_fwlog *fwlog,
+ struct pci_dev *pdev);
void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog);
int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
int ice_fwlog_register(struct ice_hw *hw, struct ice_fwlog *fwlog);
int ice_fwlog_unregister(struct ice_hw *hw, struct ice_fwlog *fwlog);
-void ice_fwlog_realloc_rings(struct ice_hw *hw, struct ice_fwlog *fwlog,
- int index);
+void ice_fwlog_realloc_rings(struct ice_fwlog *fwlog, int index);
void ice_get_fwlog_data(struct ice_fwlog *fwlog, u8 *buf, u16 len);
#endif /* _ICE_FWLOG_H_ */