linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: vishal.l.verma@linux.intel.com (Vishal Verma)
Subject: [PATCH] NVMe: Simplify Firmware Activate code slightly
Date: Mon, 06 May 2013 11:07:07 -0600	[thread overview]
Message-ID: <1367860027.21521.24.camel@teamfortress> (raw)
In-Reply-To: <1367842938-17731-1-git-send-email-matthew.r.wilcox@intel.com>

Reviewed-by: Vishal Verma <vishal.l.verma at linux.intel.com>

On Mon, 2013-05-06@08:22 -0400, Matthew Wilcox wrote:
> 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: Matthew Wilcox <matthew.r.wilcox at intel.com>
> ---
>  drivers/block/nvme-scsi.c |    6 ++----
>  include/linux/nvme.h      |    3 +++
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c
> index 1c0710c..fed54b0 100644
> --- a/drivers/block/nvme-scsi.c
> +++ b/drivers/block/nvme-scsi.c
> @@ -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.offset = cpu_to_le32(offset/BYTES_TO_DWORDS);
>  	} else if (opcode == nvme_admin_activate_fw) {
> -		c.common.cdw10[0] = cpu_to_le32(buffer_id);
> -		/* AA=01b Replace & activate at reset */
> -		c.common.cdw10[0] = cpu_to_le32(le32_to_cpu(
> -						c.common.cdw10[0]) | 0x00000008);
> +		u32 cdw10 = buffer_id | NVME_FWACT_REPL_ACTV;
> +		c.common.cdw10[0] = cpu_to_le32(cdw10);
>  	}
>  
>  	nvme_sc = nvme_submit_admin_cmd(dev, &c, NULL);
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 971ef08..f451c8d 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -316,6 +316,9 @@ enum {
>  	NVME_FEAT_WRITE_ATOMIC	= 0x0a,
>  	NVME_FEAT_ASYNC_EVENT	= 0x0b,
>  	NVME_FEAT_SW_PROGRESS	= 0x0c,
> +	NVME_FWACT_REPL		= (0 << 3),
> +	NVME_FWACT_REPL_ACTV	= (1 << 3),
> +	NVME_FWACT_ACTV		= (2 << 3),
>  };
>  
>  struct nvme_identify {

      reply	other threads:[~2013-05-06 17:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-06 12:22 [PATCH] NVMe: Simplify Firmware Activate code slightly Matthew Wilcox
2013-05-06 17:07 ` Vishal Verma [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367860027.21521.24.camel@teamfortress \
    --to=vishal.l.verma@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).