Commit ae33666a authored by Tomer Tayar's avatar Tomer Tayar Committed by David S. Miller

qed: Provide MBI information in dev_info

Pass additional information about package installed on persistent memory
so that protocol drivers would be able to log it.
Signed-off-by: default avatarTomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f855df22
...@@ -11782,6 +11782,12 @@ struct nvm_cfg1_glob { ...@@ -11782,6 +11782,12 @@ struct nvm_cfg1_glob {
u32 led_global_settings; u32 led_global_settings;
u32 generic_cont1; u32 generic_cont1;
u32 mbi_version; u32 mbi_version;
#define NVM_CFG1_GLOB_MBI_VERSION_0_MASK 0x000000FF
#define NVM_CFG1_GLOB_MBI_VERSION_0_OFFSET 0
#define NVM_CFG1_GLOB_MBI_VERSION_1_MASK 0x0000FF00
#define NVM_CFG1_GLOB_MBI_VERSION_1_OFFSET 8
#define NVM_CFG1_GLOB_MBI_VERSION_2_MASK 0x00FF0000
#define NVM_CFG1_GLOB_MBI_VERSION_2_OFFSET 16
u32 mbi_date; u32 mbi_date;
u32 misc_sig; u32 misc_sig;
u32 device_capabilities; u32 device_capabilities;
......
...@@ -281,6 +281,9 @@ int qed_fill_dev_info(struct qed_dev *cdev, ...@@ -281,6 +281,9 @@ int qed_fill_dev_info(struct qed_dev *cdev,
qed_mcp_get_mfw_ver(QED_LEADING_HWFN(cdev), ptt, qed_mcp_get_mfw_ver(QED_LEADING_HWFN(cdev), ptt,
&dev_info->mfw_rev, NULL); &dev_info->mfw_rev, NULL);
qed_mcp_get_mbi_ver(QED_LEADING_HWFN(cdev), ptt,
&dev_info->mbi_version);
qed_mcp_get_flash_size(QED_LEADING_HWFN(cdev), ptt, qed_mcp_get_flash_size(QED_LEADING_HWFN(cdev), ptt,
&dev_info->flash_size); &dev_info->flash_size);
......
...@@ -1523,6 +1523,36 @@ int qed_mcp_get_mfw_ver(struct qed_hwfn *p_hwfn, ...@@ -1523,6 +1523,36 @@ int qed_mcp_get_mfw_ver(struct qed_hwfn *p_hwfn,
return 0; return 0;
} }
int qed_mcp_get_mbi_ver(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u32 *p_mbi_ver)
{
u32 nvm_cfg_addr, nvm_cfg1_offset, mbi_ver_addr;
if (IS_VF(p_hwfn->cdev))
return -EINVAL;
/* Read the address of the nvm_cfg */
nvm_cfg_addr = qed_rd(p_hwfn, p_ptt, MISC_REG_GEN_PURP_CR0);
if (!nvm_cfg_addr) {
DP_NOTICE(p_hwfn, "Shared memory not initialized\n");
return -EINVAL;
}
/* Read the offset of nvm_cfg1 */
nvm_cfg1_offset = qed_rd(p_hwfn, p_ptt, nvm_cfg_addr + 4);
mbi_ver_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
offsetof(struct nvm_cfg1, glob) +
offsetof(struct nvm_cfg1_glob, mbi_version);
*p_mbi_ver = qed_rd(p_hwfn, p_ptt,
mbi_ver_addr) &
(NVM_CFG1_GLOB_MBI_VERSION_0_MASK |
NVM_CFG1_GLOB_MBI_VERSION_1_MASK |
NVM_CFG1_GLOB_MBI_VERSION_2_MASK);
return 0;
}
int qed_mcp_get_media_type(struct qed_dev *cdev, u32 *p_media_type) int qed_mcp_get_media_type(struct qed_dev *cdev, u32 *p_media_type)
{ {
struct qed_hwfn *p_hwfn = &cdev->hwfns[0]; struct qed_hwfn *p_hwfn = &cdev->hwfns[0];
......
...@@ -255,6 +255,18 @@ int qed_mcp_get_mfw_ver(struct qed_hwfn *p_hwfn, ...@@ -255,6 +255,18 @@ int qed_mcp_get_mfw_ver(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, struct qed_ptt *p_ptt,
u32 *p_mfw_ver, u32 *p_running_bundle_id); u32 *p_mfw_ver, u32 *p_running_bundle_id);
/**
* @brief Get the MBI version value
*
* @param p_hwfn
* @param p_ptt
* @param p_mbi_ver - A pointer to a variable to be filled with the MBI version.
*
* @return int - 0 - operation was successful.
*/
int qed_mcp_get_mbi_ver(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, u32 *p_mbi_ver);
/** /**
* @brief Get media type value of the port. * @brief Get media type value of the port.
* *
......
...@@ -328,6 +328,14 @@ struct qed_dev_info { ...@@ -328,6 +328,14 @@ struct qed_dev_info {
/* MFW version */ /* MFW version */
u32 mfw_rev; u32 mfw_rev;
#define QED_MFW_VERSION_0_MASK 0x000000FF
#define QED_MFW_VERSION_0_OFFSET 0
#define QED_MFW_VERSION_1_MASK 0x0000FF00
#define QED_MFW_VERSION_1_OFFSET 8
#define QED_MFW_VERSION_2_MASK 0x00FF0000
#define QED_MFW_VERSION_2_OFFSET 16
#define QED_MFW_VERSION_3_MASK 0xFF000000
#define QED_MFW_VERSION_3_OFFSET 24
u32 flash_size; u32 flash_size;
u8 mf_mode; u8 mf_mode;
...@@ -337,6 +345,15 @@ struct qed_dev_info { ...@@ -337,6 +345,15 @@ struct qed_dev_info {
bool wol_support; bool wol_support;
/* MBI version */
u32 mbi_version;
#define QED_MBI_VERSION_0_MASK 0x000000FF
#define QED_MBI_VERSION_0_OFFSET 0
#define QED_MBI_VERSION_1_MASK 0x0000FF00
#define QED_MBI_VERSION_1_OFFSET 8
#define QED_MBI_VERSION_2_MASK 0x00FF0000
#define QED_MBI_VERSION_2_OFFSET 16
enum qed_dev_type dev_type; enum qed_dev_type dev_type;
/* Output parameters for qede */ /* Output parameters for qede */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment