nvme: Rename min_page_size to page_size and save mps

The Memory Page Size sets the basic unit of operation for the drive. We
currently set this to the drive's minimum page size, but we could set it
to any page size the drive supports in the future. Replace min_page_size
(it's now unused for that purpose) with page_size to reflect this and
cache the MPS we want to use. Use NVME_MPS_SHIFT to compute page_size.

Sponsored by:		Netflix
Reviewed by:		chuck
Differential Revision:	https://reviews.freebsd.org/D34868
This commit is contained in:
Warner Losh 2022-04-15 14:41:13 -06:00
parent 6e3deec8ca
commit 55412ef90a
2 changed files with 5 additions and 5 deletions

View File

@ -1380,7 +1380,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
uint32_t cap_lo;
uint32_t cap_hi;
uint32_t to, vs, pmrcap;
uint8_t mpsmin;
int status, timeout_period;
ctrlr->dev = dev;
@ -1432,8 +1431,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2;
mpsmin = NVME_CAP_HI_MPSMIN(cap_hi);
ctrlr->min_page_size = 1 << (12 + mpsmin);
ctrlr->mps = NVME_CAP_HI_MPSMIN(cap_hi);
ctrlr->page_size = 1 << (NVME_MPS_SHIFT + ctrlr->mps);
/* Get ready timeout value from controller, in units of 500ms. */
to = NVME_CAP_LO_TO(cap_lo) + 1;

View File

@ -288,8 +288,9 @@ struct nvme_controller {
uint32_t cap_lo;
uint32_t cap_hi;
/** minimum page size supported by this controller in bytes */
uint32_t min_page_size;
/** Page size and log2(page_size) - 12 that we're currently using */
uint32_t page_size;
uint32_t mps;
/** interrupt coalescing time period (in microseconds) */
uint32_t int_coal_time;