diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-02-01 16:18:08 -0500 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-11-04 15:52:53 -0400 |
commit | 51814232ecae90f888c902e252306df8d017f0dd (patch) | |
tree | 2a9bcdf23cdf24e21ecb33315aadfd92facee74f /drivers/block/nvme.c | |
parent | a53295b6998f62d961c29e54051c1cf1d738c2b3 (diff) | |
download | lwn-51814232ecae90f888c902e252306df8d017f0dd.tar.gz lwn-51814232ecae90f888c902e252306df8d017f0dd.zip |
NVMe: Read the model, serial & firmware rev from the controller
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r-- | drivers/block/nvme.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 40fb2e1bdfe4..12e37c1cf057 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c @@ -58,6 +58,9 @@ struct nvme_dev { struct msix_entry *entry; struct nvme_bar __iomem *bar; struct list_head namespaces; + char serial[20]; + char model[40]; + char firmware_rev[8]; }; /* @@ -979,6 +982,7 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev) { int res, nn, i; struct nvme_ns *ns, *next; + struct nvme_id_ctrl *ctrl; void *id; dma_addr_t dma_addr; struct nvme_command cid, crt; @@ -1003,7 +1007,11 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev) goto out_free; } - nn = le32_to_cpup(&((struct nvme_id_ctrl *)id)->nn); + ctrl = id; + nn = le32_to_cpup(&ctrl->nn); + memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn)); + memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn)); + memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr)); cid.identify.cns = 0; memset(&crt, 0, sizeof(crt)); |