mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
ice: refactor ice_ddp to make functions static
As following methods are not used outside of ice_ddp, they can be made static: ice_verify_pgk ice_pkg_val_buf ice_aq_download_pkg ice_aq_update_pkg ice_find_seg_in_pkg Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
74e7940e0d
commit
708b352fc6
|
|
@ -30,7 +30,7 @@ static const struct ice_tunnel_type_scan tnls[] = {
|
|||
* Verifies various attributes of the package file, including length, format
|
||||
* version, and the requirement of at least one segment.
|
||||
*/
|
||||
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
|
||||
static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
|
||||
{
|
||||
u32 seg_count;
|
||||
u32 i;
|
||||
|
|
@ -118,7 +118,7 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)
|
|||
*
|
||||
* This helper function validates a buffer's header.
|
||||
*/
|
||||
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
|
||||
static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
|
||||
{
|
||||
struct ice_buf_hdr *hdr;
|
||||
u16 section_count;
|
||||
|
|
@ -1152,6 +1152,54 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw)
|
|||
ice_release_res(hw, ICE_GLOBAL_CFG_LOCK_RES_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_download_pkg
|
||||
* @hw: pointer to the hardware structure
|
||||
* @pkg_buf: the package buffer to transfer
|
||||
* @buf_size: the size of the package buffer
|
||||
* @last_buf: last buffer indicator
|
||||
* @error_offset: returns error offset
|
||||
* @error_info: returns error information
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Download Package (0x0C40)
|
||||
*/
|
||||
static int
|
||||
ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, bool last_buf, u32 *error_offset,
|
||||
u32 *error_info, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_download_pkg *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
int status;
|
||||
|
||||
if (error_offset)
|
||||
*error_offset = 0;
|
||||
if (error_info)
|
||||
*error_info = 0;
|
||||
|
||||
cmd = &desc.params.download_pkg;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
|
||||
if (last_buf)
|
||||
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
|
||||
|
||||
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
|
||||
if (status == -EIO) {
|
||||
/* Read error from buffer only when the FW returned an error */
|
||||
struct ice_aqc_download_pkg_resp *resp;
|
||||
|
||||
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
|
||||
if (error_offset)
|
||||
*error_offset = le32_to_cpu(resp->error_offset);
|
||||
if (error_info)
|
||||
*error_info = le32_to_cpu(resp->error_info);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_dwnld_cfg_bufs
|
||||
* @hw: pointer to the hardware structure
|
||||
|
|
@ -1293,73 +1341,6 @@ static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw,
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_download_pkg
|
||||
* @hw: pointer to the hardware structure
|
||||
* @pkg_buf: the package buffer to transfer
|
||||
* @buf_size: the size of the package buffer
|
||||
* @last_buf: last buffer indicator
|
||||
* @error_offset: returns error offset
|
||||
* @error_info: returns error information
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Download Package (0x0C40)
|
||||
*/
|
||||
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, bool last_buf, u32 *error_offset,
|
||||
u32 *error_info, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_download_pkg *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
int status;
|
||||
|
||||
if (error_offset)
|
||||
*error_offset = 0;
|
||||
if (error_info)
|
||||
*error_info = 0;
|
||||
|
||||
cmd = &desc.params.download_pkg;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
|
||||
if (last_buf)
|
||||
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
|
||||
|
||||
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
|
||||
if (status == -EIO) {
|
||||
/* Read error from buffer only when the FW returned an error */
|
||||
struct ice_aqc_download_pkg_resp *resp;
|
||||
|
||||
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
|
||||
if (error_offset)
|
||||
*error_offset = le32_to_cpu(resp->error_offset);
|
||||
if (error_info)
|
||||
*error_info = le32_to_cpu(resp->error_info);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_upload_section
|
||||
* @hw: pointer to the hardware structure
|
||||
* @pkg_buf: the package buffer which will receive the section
|
||||
* @buf_size: the size of the package buffer
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Upload Section (0x0C41)
|
||||
*/
|
||||
int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_upload_section);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
|
||||
return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_update_pkg
|
||||
* @hw: pointer to the hardware structure
|
||||
|
|
@ -1407,6 +1388,26 @@ static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_upload_section
|
||||
* @hw: pointer to the hardware structure
|
||||
* @pkg_buf: the package buffer which will receive the section
|
||||
* @buf_size: the size of the package buffer
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Upload Section (0x0C41)
|
||||
*/
|
||||
int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aq_desc desc;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_upload_section);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
|
||||
return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_update_pkg_no_lock
|
||||
* @hw: pointer to the hardware structure
|
||||
|
|
@ -1470,8 +1471,9 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
|
|||
* success it returns a pointer to the segment header, otherwise it will
|
||||
* return NULL.
|
||||
*/
|
||||
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
|
||||
struct ice_pkg_hdr *pkg_hdr)
|
||||
static struct ice_generic_seg_hdr *
|
||||
ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
|
||||
struct ice_pkg_hdr *pkg_hdr)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
|
|
|||
|
|
@ -416,21 +416,13 @@ struct ice_pkg_enum {
|
|||
void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
|
||||
};
|
||||
|
||||
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, bool last_buf, u32 *error_offset,
|
||||
u32 *error_info, struct ice_sq_cd *cd);
|
||||
int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd);
|
||||
|
||||
void *ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size);
|
||||
|
||||
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len);
|
||||
|
||||
struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw);
|
||||
|
||||
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
|
||||
struct ice_pkg_hdr *pkg_hdr);
|
||||
|
||||
int ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
|
||||
int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
|
||||
|
||||
|
|
@ -439,6 +431,4 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);
|
|||
void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
|
||||
u32 sect_type);
|
||||
|
||||
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user