Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/nvme/nvme_da.c
Show First 20 Lines • Show All 900 Lines • ▼ Show 20 Lines | ndaregister(struct cam_periph *periph, void *arg) | ||||
disk->d_dump = ndadump; | disk->d_dump = ndadump; | ||||
disk->d_gone = ndadiskgonecb; | disk->d_gone = ndadiskgonecb; | ||||
disk->d_name = "nda"; | disk->d_name = "nda"; | ||||
disk->d_drv1 = periph; | disk->d_drv1 = periph; | ||||
disk->d_unit = periph->unit_number; | disk->d_unit = periph->unit_number; | ||||
maxio = cpi.maxio; /* Honor max I/O size of SIM */ | maxio = cpi.maxio; /* Honor max I/O size of SIM */ | ||||
if (maxio == 0) | if (maxio == 0) | ||||
maxio = DFLTPHYS; /* traditional default */ | maxio = DFLTPHYS; /* traditional default */ | ||||
else if (maxio > MAXPHYS) | else if (maxio > maxphys) | ||||
maxio = MAXPHYS; /* for safety */ | maxio = maxphys; /* for safety */ | ||||
disk->d_maxsize = maxio; | disk->d_maxsize = maxio; | ||||
flbas_fmt = (nsd->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & | flbas_fmt = (nsd->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & | ||||
NVME_NS_DATA_FLBAS_FORMAT_MASK; | NVME_NS_DATA_FLBAS_FORMAT_MASK; | ||||
lbads = (nsd->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & | lbads = (nsd->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & | ||||
NVME_NS_DATA_LBAF_LBADS_MASK; | NVME_NS_DATA_LBAF_LBADS_MASK; | ||||
disk->d_sectorsize = 1 << lbads; | disk->d_sectorsize = 1 << lbads; | ||||
disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze); | disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze); | ||||
disk->d_delmaxsize = disk->d_mediasize; | disk->d_delmaxsize = disk->d_mediasize; | ||||
▲ Show 20 Lines • Show All 444 Lines • Show Last 20 Lines |