Index: usr.sbin/bhyve/bhyve.8 =================================================================== --- usr.sbin/bhyve/bhyve.8 +++ usr.sbin/bhyve/bhyve.8 @@ -536,6 +536,10 @@ Sector size (defaults to blockif sector size). .It Li ser Serial number with maximum 20 characters. +.It Li model +Model number with maximum 40 characters. +.It Li rev +Revision with maximum 8 characters. .El .Pp HD Audio devices: Index: usr.sbin/bhyve/pci_nvme.c =================================================================== --- usr.sbin/bhyve/pci_nvme.c +++ usr.sbin/bhyve/pci_nvme.c @@ -33,7 +33,8 @@ * bhyve PCIe-NVMe device emulation. * * options: - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=# + * ,ser=A-Z,model=A-Z,rev=A-Z,eui64=# * * accepted devpath: * /dev/blockdev @@ -45,6 +46,8 @@ * ioslots = max number of concurrent io requests * sectsz = sector size (defaults to blockif sector size) * ser = serial number (20-chars max) + * model = model number (40-chars max) + * rev = revision (8-chars max) * eui64 = IEEE Extended Unique Identifier (8 byte value) * */ @@ -344,9 +347,6 @@ cd->vid = 0xFB5D; cd->ssvid = 0x0000; - cpywithpad((char *)cd->mn, sizeof(cd->mn), "bhyve-NVMe", ' '); - cpywithpad((char *)cd->fr, sizeof(cd->fr), "1.0", ' '); - /* Num of submission commands that we can handle at a time (2^rab) */ cd->rab = 4; @@ -2022,6 +2022,7 @@ char *uopt, *xopts, *config; uint32_t sectsz; int optidx; + struct nvme_controller_data *cd = &sc->ctrldata; sc->max_queues = NVME_QUEUES; sc->max_qentries = NVME_MAX_QENTRIES; @@ -2031,6 +2032,9 @@ sc->dataset_management = NVME_DATASET_MANAGEMENT_AUTO; sectsz = 0; + cpywithpad((char *)cd->mn, sizeof(cd->mn), "bhyve-NVMe", ' '); + cpywithpad((char *)cd->fr, sizeof(cd->fr), "1.0", ' '); + uopt = strdup(opts); optidx = 0; snprintf(sc->ctrldata.sn, sizeof(sc->ctrldata.sn), @@ -2056,8 +2060,11 @@ * 7-bit ASCII, unused bytes should be space characters. * Ref: NVMe v1.3c. */ - cpywithpad((char *)sc->ctrldata.sn, - sizeof(sc->ctrldata.sn), config, ' '); + cpywithpad((char *)cd->sn, sizeof(cd->sn), config, ' '); + } else if (!strcmp("model", xopts)) { + cpywithpad((char *)cd->mn, sizeof(cd->mn), config, ' '); + } else if (!strcmp("rev", xopts)) { + cpywithpad((char*)cd->fr, sizeof(cd->fr), config, ' '); } else if (!strcmp("ram", xopts)) { uint64_t sz = strtoull(&xopts[4], NULL, 10);