> On 5 Feb 2018, at 13.15, Matias Bjørling <mb@xxxxxxxxxxx> wrote: > > Implement the geometry data structures for 2.0 and enable a drive > to be identified as one, including exposing the appropriate 2.0 > sysfs entries. > > Signed-off-by: Matias Bjørling <mb@xxxxxxxxxxx> > --- > drivers/lightnvm/core.c | 2 +- > drivers/nvme/host/lightnvm.c | 334 +++++++++++++++++++++++++++++++++++++------ > include/linux/lightnvm.h | 11 +- > 3 files changed, 295 insertions(+), 52 deletions(-) > > diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c > index c72863b36439..250e74dfa120 100644 > --- a/drivers/lightnvm/core.c > +++ b/drivers/lightnvm/core.c > @@ -934,7 +934,7 @@ static int nvm_init(struct nvm_dev *dev) > pr_debug("nvm: ver:%x nvm_vendor:%x\n", > dev->identity.ver_id, dev->identity.vmnt); > > - if (dev->identity.ver_id != 1) { > + if (dev->identity.ver_id != 1 && dev->identity.ver_id != 2) { > pr_err("nvm: device not supported by kernel."); > goto err; > } > diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c > index 6412551ecc65..a9c010655ccc 100644 > --- a/drivers/nvme/host/lightnvm.c > +++ b/drivers/nvme/host/lightnvm.c > @@ -184,6 +184,58 @@ struct nvme_nvm_bb_tbl { > __u8 blk[0]; > }; > > +struct nvme_nvm_id20_addrf { > + __u8 grp_len; > + __u8 pu_len; > + __u8 chk_len; > + __u8 lba_len; > + __u8 resv[4]; > +}; > + > +struct nvme_nvm_id20 { > + __u8 mjr; > + __u8 mnr; > + __u8 resv[6]; > + > + struct nvme_nvm_id20_addrf lbaf; > + > + __u32 mccap; > + __u8 resv2[12]; > + > + __u8 wit; > + __u8 resv3[31]; > + > + /* Geometry */ > + __u16 num_grp; > + __u16 num_pu; > + __u32 num_chk; > + __u32 clba; > + __u8 resv4[52]; > + > + /* Write data requirements */ > + __u32 ws_min; > + __u32 ws_opt; > + __u32 mw_cunits; > + __u32 maxoc; > + __u32 maxocpu; > + __u8 resv5[44]; > + > + /* Performance related metrics */ > + __u32 trdt; > + __u32 trdm; > + __u32 twrt; > + __u32 twrm; > + __u32 tcrst; > + __u32 tcrsm; > + __u8 resv6[40]; > + > + /* Reserved area */ > + __u8 resv7[2816]; > + > + /* Vendor specific */ > + __u8 vs[1024]; > +}; > All __u16, __u32 should be __le16, __le32 Javier
Attachment:
signature.asc
Description: Message signed with OpenPGP