Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_nvme.c
Show First 20 Lines • Show All 544 Lines • ▼ Show 20 Lines | pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) | ||||
cd->acl = 2; | cd->acl = 2; | ||||
cd->aerl = 4; | cd->aerl = 4; | ||||
/* Advertise 1, Read-only firmware slot */ | /* Advertise 1, Read-only firmware slot */ | ||||
cd->frmw = NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK | | cd->frmw = NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK | | ||||
(1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT); | (1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT); | ||||
cd->lpa = 0; /* TODO: support some simple things like SMART */ | cd->lpa = 0; /* TODO: support some simple things like SMART */ | ||||
cd->elpe = 0; /* max error log page entries */ | cd->elpe = 0; /* max error log page entries */ | ||||
cd->npss = 1; /* number of power states support */ | /* | ||||
* Report a single power state (zero-based value) | |||||
* power_state[] values are left as zero to indicate "Not reported" | |||||
*/ | |||||
cd->npss = 0; | |||||
markj: I think the comment should also clarify that the value is zero-indexed, otherwise this line… | |||||
/* Warning Composite Temperature Threshold */ | /* Warning Composite Temperature Threshold */ | ||||
cd->wctemp = 0x0157; | cd->wctemp = 0x0157; | ||||
cd->cctemp = 0x0157; | cd->cctemp = 0x0157; | ||||
cd->sqes = (6 << NVME_CTRLR_DATA_SQES_MAX_SHIFT) | | cd->sqes = (6 << NVME_CTRLR_DATA_SQES_MAX_SHIFT) | | ||||
(6 << NVME_CTRLR_DATA_SQES_MIN_SHIFT); | (6 << NVME_CTRLR_DATA_SQES_MIN_SHIFT); | ||||
cd->cqes = (4 << NVME_CTRLR_DATA_CQES_MAX_SHIFT) | | cd->cqes = (4 << NVME_CTRLR_DATA_CQES_MAX_SHIFT) | | ||||
Show All 12 Lines | pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
cd->fna = NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK << | cd->fna = NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK << | ||||
NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT; | NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT; | ||||
cd->vwc = NVME_CTRLR_DATA_VWC_ALL_NO << NVME_CTRLR_DATA_VWC_ALL_SHIFT; | cd->vwc = NVME_CTRLR_DATA_VWC_ALL_NO << NVME_CTRLR_DATA_VWC_ALL_SHIFT; | ||||
cd->power_state[0].mp = 10; | |||||
} | } | ||||
/* | /* | ||||
* Calculate the CRC-16 of the given buffer | * Calculate the CRC-16 of the given buffer | ||||
* See copyright attribution at top of file | * See copyright attribution at top of file | ||||
*/ | */ | ||||
static uint16_t | static uint16_t | ||||
crc16(uint16_t crc, const void *buffer, unsigned int len) | crc16(uint16_t crc, const void *buffer, unsigned int len) | ||||
▲ Show 20 Lines • Show All 2,760 Lines • Show Last 20 Lines |
I think the comment should also clarify that the value is zero-indexed, otherwise this line looks wrong.