mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-23 03:06:48 +00:00
nda: Use the NVMEV macro instead of expanded versions
Reviewed by: chuck Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43596
This commit is contained in:
parent
479680f235
commit
2cb78e7150
|
@ -911,18 +911,15 @@ ndaregister(struct cam_periph *periph, void *arg)
|
|||
else if (maxio > maxphys)
|
||||
maxio = maxphys; /* for safety */
|
||||
disk->d_maxsize = maxio;
|
||||
flbas_fmt = (nsd->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) &
|
||||
NVME_NS_DATA_FLBAS_FORMAT_MASK;
|
||||
lbads = (nsd->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_LBADS_SHIFT) &
|
||||
NVME_NS_DATA_LBAF_LBADS_MASK;
|
||||
flbas_fmt = NVMEV(NVME_NS_DATA_FLBAS_FORMAT, nsd->flbas);
|
||||
lbads = NVMEV(NVME_NS_DATA_LBAF_LBADS, nsd->lbaf[flbas_fmt]);
|
||||
disk->d_sectorsize = 1 << lbads;
|
||||
disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze);
|
||||
disk->d_delmaxsize = disk->d_mediasize;
|
||||
disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
|
||||
if (nvme_ctrlr_has_dataset_mgmt(cd))
|
||||
disk->d_flags |= DISKFLAG_CANDELETE;
|
||||
vwc_present = (cd->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
|
||||
NVME_CTRLR_DATA_VWC_PRESENT_MASK;
|
||||
vwc_present = NVMEV(NVME_CTRLR_DATA_VWC_PRESENT, cd->vwc);
|
||||
if (vwc_present)
|
||||
disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
|
||||
if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
|
||||
|
@ -945,8 +942,8 @@ ndaregister(struct cam_periph *periph, void *arg)
|
|||
disk->d_hba_subdevice = cpi.hba_subdevice;
|
||||
snprintf(disk->d_attachment, sizeof(disk->d_attachment),
|
||||
"%s%d", cpi.dev_name, cpi.unit_number);
|
||||
if (((nsd->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) &
|
||||
NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && nsd->npwg != 0)
|
||||
if (NVMEV(NVME_NS_DATA_NSFEAT_NPVALID, nsd->nsfeat) != 0 &&
|
||||
nsd->npwg != 0)
|
||||
disk->d_stripesize = ((nsd->npwg + 1) * disk->d_sectorsize);
|
||||
else
|
||||
disk->d_stripesize = nsd->noiob * disk->d_sectorsize;
|
||||
|
|
Loading…
Reference in a new issue