mirror of
https://github.com/torvalds/linux.git
synced 2026-04-23 00:55:48 -04:00
ixgbe: add .info_get extension specific for E610 devices
E610 devices give possibility to show more detailed info than the previous boards. Extend reporting NVM info with following pieces: fw.mgmt.api -> version number of the API fw.mgmt.build -> identifier of the source for the FW fw.mgmt.srev -> number defining FW's security revision fw.psid.api -> version defining the format of the flash contents fw.undi.srev -> number defining OROM's security revision fw.netlist -> version of the netlist module fw.netlist.build -> first 4 bytes of the netlist hash Co-developed-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com> Co-developed-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com> Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
committed by
Tony Nguyen
parent
904c2b4c0b
commit
8210ff7380
@@ -19,14 +19,22 @@ static void ixgbe_info_get_dsn(struct ixgbe_adapter *adapter,
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
|
||||
}
|
||||
|
||||
static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
static void ixgbe_info_orom_ver(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
struct ixgbe_nvm_version nvm_ver;
|
||||
|
||||
ctx->buf[0] = '\0';
|
||||
|
||||
if (hw->mac.type == ixgbe_mac_e610) {
|
||||
struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
|
||||
orom->major, orom->build, orom->patch);
|
||||
return;
|
||||
}
|
||||
|
||||
ixgbe_get_oem_prod_version(hw, &nvm_ver);
|
||||
if (nvm_ver.oem_valid) {
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x",
|
||||
@@ -48,6 +56,12 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
struct ixgbe_nvm_version nvm_ver;
|
||||
|
||||
if (hw->mac.type == ixgbe_mac_e610) {
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x",
|
||||
hw->flash.nvm.eetrack);
|
||||
return;
|
||||
}
|
||||
|
||||
ixgbe_get_oem_prod_version(hw, &nvm_ver);
|
||||
|
||||
/* No ETRACK version for OEM */
|
||||
@@ -60,6 +74,110 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm_ver.etk_id);
|
||||
}
|
||||
|
||||
static void ixgbe_info_fw_api(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
|
||||
hw->api_maj_ver, hw->api_min_ver, hw->api_patch);
|
||||
}
|
||||
|
||||
static void ixgbe_info_fw_build(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build);
|
||||
}
|
||||
|
||||
static void ixgbe_info_fw_srev(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%u", nvm->srev);
|
||||
}
|
||||
|
||||
static void ixgbe_info_orom_srev(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%u", orom->srev);
|
||||
}
|
||||
|
||||
static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor);
|
||||
}
|
||||
|
||||
static void ixgbe_info_netlist_ver(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist;
|
||||
|
||||
/* The netlist version fields are BCD formatted */
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x",
|
||||
netlist->major, netlist->minor,
|
||||
netlist->type >> 16, netlist->type & 0xFFFF,
|
||||
netlist->rev, netlist->cust_ver);
|
||||
}
|
||||
|
||||
static void ixgbe_info_netlist_build(struct ixgbe_adapter *adapter,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
struct ixgbe_netlist_info *netlist = &adapter->hw.flash.netlist;
|
||||
|
||||
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash);
|
||||
}
|
||||
|
||||
static int ixgbe_devlink_info_get_e610(struct ixgbe_adapter *adapter,
|
||||
struct devlink_info_req *req,
|
||||
struct ixgbe_info_ctx *ctx)
|
||||
{
|
||||
int err;
|
||||
|
||||
ixgbe_info_fw_api(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req,
|
||||
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API,
|
||||
ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_fw_build(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req, "fw.mgmt.build", ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_fw_srev(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req, "fw.mgmt.srev", ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_orom_srev(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req, "fw.undi.srev", ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_nvm_ver(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req, "fw.psid.api", ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_netlist_ver(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req, "fw.netlist", ctx->buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ixgbe_info_netlist_build(adapter, ctx);
|
||||
return devlink_info_version_running_put(req, "fw.netlist.build",
|
||||
ctx->buf);
|
||||
}
|
||||
|
||||
static int ixgbe_devlink_info_get(struct devlink *devlink,
|
||||
struct devlink_info_req *req,
|
||||
struct netlink_ext_ack *extack)
|
||||
@@ -88,7 +206,7 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
|
||||
if (err)
|
||||
goto free_ctx;
|
||||
|
||||
ixgbe_info_nvm_ver(adapter, ctx);
|
||||
ixgbe_info_orom_ver(adapter, ctx);
|
||||
err = devlink_info_version_running_put(req,
|
||||
DEVLINK_INFO_VERSION_GENERIC_FW_UNDI,
|
||||
ctx->buf);
|
||||
@@ -99,6 +217,10 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
|
||||
err = devlink_info_version_running_put(req,
|
||||
DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID,
|
||||
ctx->buf);
|
||||
if (err || hw->mac.type != ixgbe_mac_e610)
|
||||
goto free_ctx;
|
||||
|
||||
err = ixgbe_devlink_info_get_e610(adapter, req, ctx);
|
||||
free_ctx:
|
||||
kfree(ctx);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user