Commit ab3ea5bf authored by Matthew Wilcox's avatar Matthew Wilcox

NVMe: Simplify Firmware Activate code slightly

Add definitions for the three Firmware Activate actions, and change the
SCSI translation code to construct the command into a temporary variable
instead of translating the endianness back-and-forth.
Signed-off-by: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: default avatarVishal Verma <vishal.l.verma@linux.intel.com>
parent 44af146a
...@@ -1577,10 +1577,8 @@ static int nvme_trans_send_fw_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr, ...@@ -1577,10 +1577,8 @@ static int nvme_trans_send_fw_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr,
c.dlfw.numd = cpu_to_le32((tot_len/BYTES_TO_DWORDS) - 1); c.dlfw.numd = cpu_to_le32((tot_len/BYTES_TO_DWORDS) - 1);
c.dlfw.offset = cpu_to_le32(offset/BYTES_TO_DWORDS); c.dlfw.offset = cpu_to_le32(offset/BYTES_TO_DWORDS);
} else if (opcode == nvme_admin_activate_fw) { } else if (opcode == nvme_admin_activate_fw) {
c.common.cdw10[0] = cpu_to_le32(buffer_id); u32 cdw10 = buffer_id | NVME_FWACT_REPL_ACTV;
/* AA=01b Replace & activate at reset */ c.common.cdw10[0] = cpu_to_le32(cdw10);
c.common.cdw10[0] = cpu_to_le32(le32_to_cpu(
c.common.cdw10[0]) | 0x00000008);
} }
nvme_sc = nvme_submit_admin_cmd(dev, &c, NULL); nvme_sc = nvme_submit_admin_cmd(dev, &c, NULL);
......
...@@ -316,6 +316,9 @@ enum { ...@@ -316,6 +316,9 @@ enum {
NVME_FEAT_WRITE_ATOMIC = 0x0a, NVME_FEAT_WRITE_ATOMIC = 0x0a,
NVME_FEAT_ASYNC_EVENT = 0x0b, NVME_FEAT_ASYNC_EVENT = 0x0b,
NVME_FEAT_SW_PROGRESS = 0x0c, NVME_FEAT_SW_PROGRESS = 0x0c,
NVME_FWACT_REPL = (0 << 3),
NVME_FWACT_REPL_ACTV = (1 << 3),
NVME_FWACT_ACTV = (2 << 3),
}; };
struct nvme_identify { struct nvme_identify {
......
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