aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2024-01-29 18:33:39 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2024-08-26 17:26:00 +0000
commite8edea1b4cc5aae7897439821a611257a32a879c (patch)
tree3df17fd9fbade84be733da1976b5dada7507062c
parent215c3766945abf085c580b73bb409fd4afe5ff09 (diff)
downloadsrc-e8edea1b4cc5aae7897439821a611257a32a879c.tar.gz
src-e8edea1b4cc5aae7897439821a611257a32a879c.zip
nda: Use the NVMEV macro instead of expanded versions
Reviewed by: chuck Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43596 (cherry picked from commit 2cb78e71503ec9a73054a6f70908c5f20c2ceb73)
-rw-r--r--sys/cam/nvme/nvme_da.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index 9901ecccf21c..33efbc66773c 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -912,18 +912,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) {
@@ -946,8 +943,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;