Commit 0652cb5b authored by David S. Miller's avatar David S. Miller

Merge branch 'bnxt_en-zeropad-fw-and-reset'

Michael Chan says:

====================
bnxt_en: Zero pad fw messages and add fw reset.

2 patches related to firmware for net-next.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1f211a1b d2d6318c
...@@ -2614,6 +2614,9 @@ int _hwrm_send_message(struct bnxt *bp, void *msg, u32 msg_len, int timeout) ...@@ -2614,6 +2614,9 @@ int _hwrm_send_message(struct bnxt *bp, void *msg, u32 msg_len, int timeout)
/* Write request msg to hwrm channel */ /* Write request msg to hwrm channel */
__iowrite32_copy(bp->bar0, data, msg_len / 4); __iowrite32_copy(bp->bar0, data, msg_len / 4);
for (i = msg_len; i < HWRM_MAX_REQ_LEN; i += 4)
writel(0, bp->bar0 + i);
/* currently supports only one outstanding message */ /* currently supports only one outstanding message */
if (intr_process) if (intr_process)
bp->hwrm_intr_seq_id = le32_to_cpu(req->target_id_seq_id) & bp->hwrm_intr_seq_id = le32_to_cpu(req->target_id_seq_id) &
......
...@@ -837,6 +837,45 @@ static int bnxt_flash_nvram(struct net_device *dev, ...@@ -837,6 +837,45 @@ static int bnxt_flash_nvram(struct net_device *dev,
return rc; return rc;
} }
static int bnxt_firmware_reset(struct net_device *dev,
u16 dir_type)
{
struct bnxt *bp = netdev_priv(dev);
struct hwrm_fw_reset_input req = {0};
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1, -1);
/* TODO: Support ASAP ChiMP self-reset (e.g. upon PF driver unload) */
/* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */
/* (e.g. when firmware isn't already running) */
switch (dir_type) {
case BNX_DIR_TYPE_CHIMP_PATCH:
case BNX_DIR_TYPE_BOOTCODE:
case BNX_DIR_TYPE_BOOTCODE_2:
req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_BOOT;
/* Self-reset ChiMP upon next PCIe reset: */
req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTPCIERST;
break;
case BNX_DIR_TYPE_APE_FW:
case BNX_DIR_TYPE_APE_PATCH:
req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_MGMT;
break;
case BNX_DIR_TYPE_KONG_FW:
case BNX_DIR_TYPE_KONG_PATCH:
req.embedded_proc_type =
FW_RESET_REQ_EMBEDDED_PROC_TYPE_NETCTRL;
break;
case BNX_DIR_TYPE_BONO_FW:
case BNX_DIR_TYPE_BONO_PATCH:
req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE;
break;
default:
return -EINVAL;
}
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
}
static int bnxt_flash_firmware(struct net_device *dev, static int bnxt_flash_firmware(struct net_device *dev,
u16 dir_type, u16 dir_type,
const u8 *fw_data, const u8 *fw_data,
...@@ -894,10 +933,9 @@ static int bnxt_flash_firmware(struct net_device *dev, ...@@ -894,10 +933,9 @@ static int bnxt_flash_firmware(struct net_device *dev,
/* TODO: Validate digital signature (RSA-encrypted SHA-256 hash) here */ /* TODO: Validate digital signature (RSA-encrypted SHA-256 hash) here */
rc = bnxt_flash_nvram(dev, dir_type, BNX_DIR_ORDINAL_FIRST, rc = bnxt_flash_nvram(dev, dir_type, BNX_DIR_ORDINAL_FIRST,
0, 0, fw_data, fw_size); 0, 0, fw_data, fw_size);
if (rc == 0) { /* Firmware update successful */ if (rc == 0) /* Firmware update successful */
/* TODO: Notify processor it needs to reset itself rc = bnxt_firmware_reset(dev, dir_type);
*/
}
return rc; return rc;
} }
......
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