NVMe spec version 1.3c says that "serial number" field must be 7-bit ASCII,
with unused bytes padded by space characters. Same for firmware number and namespace number. Discussed with: imp@ Sponsored by: iXsystems Inc.
This commit is contained in:
parent
b018ea0174
commit
6b2c20cd98
@ -253,6 +253,14 @@ static void pci_nvme_io_partial(struct blockif_req *br, int err);
|
|||||||
((NVME_STATUS_SCT_MASK << NVME_STATUS_SCT_SHIFT) |\
|
((NVME_STATUS_SCT_MASK << NVME_STATUS_SCT_SHIFT) |\
|
||||||
(NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT))
|
(NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT))
|
||||||
|
|
||||||
|
static __inline void
|
||||||
|
cpywithpad(char *dst, int dst_size, const char *src, char pad)
|
||||||
|
{
|
||||||
|
int len = strnlen(src, dst_size);
|
||||||
|
memcpy(dst, src, len);
|
||||||
|
memset(dst + len, pad, dst_size - len);
|
||||||
|
}
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
pci_nvme_status_tc(uint16_t *status, uint16_t type, uint16_t code)
|
pci_nvme_status_tc(uint16_t *status, uint16_t type, uint16_t code)
|
||||||
{
|
{
|
||||||
@ -287,20 +295,8 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc)
|
|||||||
cd->vid = 0xFB5D;
|
cd->vid = 0xFB5D;
|
||||||
cd->ssvid = 0x0000;
|
cd->ssvid = 0x0000;
|
||||||
|
|
||||||
cd->mn[0] = 'b';
|
cpywithpad((char *)cd->mn, sizeof(cd->mn), "bhyve-NVMe", ' ');
|
||||||
cd->mn[1] = 'h';
|
cpywithpad((char *)cd->fr, sizeof(cd->fr), "1.0", ' ');
|
||||||
cd->mn[2] = 'y';
|
|
||||||
cd->mn[3] = 'v';
|
|
||||||
cd->mn[4] = 'e';
|
|
||||||
cd->mn[5] = '-';
|
|
||||||
cd->mn[6] = 'N';
|
|
||||||
cd->mn[7] = 'V';
|
|
||||||
cd->mn[8] = 'M';
|
|
||||||
cd->mn[9] = 'e';
|
|
||||||
|
|
||||||
cd->fr[0] = '1';
|
|
||||||
cd->fr[1] = '.';
|
|
||||||
cd->fr[2] = '0';
|
|
||||||
|
|
||||||
/* Num of submission commands that we can handle at a time (2^rab) */
|
/* Num of submission commands that we can handle at a time (2^rab) */
|
||||||
cd->rab = 4;
|
cd->rab = 4;
|
||||||
@ -1715,12 +1711,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *opts)
|
|||||||
} else if (!strcmp("ser", xopts)) {
|
} else if (!strcmp("ser", xopts)) {
|
||||||
/*
|
/*
|
||||||
* This field indicates the Product Serial Number in
|
* This field indicates the Product Serial Number in
|
||||||
* 8-bit ASCII, unused bytes should be NULL characters.
|
* 7-bit ASCII, unused bytes should be space characters.
|
||||||
* Ref: NVM Express Management Interface 1.0a.
|
* Ref: NVMe v1.3c.
|
||||||
*/
|
*/
|
||||||
memset(sc->ctrldata.sn, 0, sizeof(sc->ctrldata.sn));
|
cpywithpad((char *)sc->ctrldata.sn,
|
||||||
strncpy(sc->ctrldata.sn, config,
|
sizeof(sc->ctrldata.sn), config, ' ');
|
||||||
sizeof(sc->ctrldata.sn));
|
|
||||||
} else if (!strcmp("ram", xopts)) {
|
} else if (!strcmp("ram", xopts)) {
|
||||||
uint64_t sz = strtoull(&xopts[4], NULL, 10);
|
uint64_t sz = strtoull(&xopts[4], NULL, 10);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user