git: 6af6a52ee47b - main - nvme: Save cap_lo and cap_hi
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Apr 2022 03:17:58 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6af6a52ee47bbe1b6148006bd33377f419f9643a commit 6af6a52ee47bbe1b6148006bd33377f419f9643a Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-03-29 22:59:05 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2022-04-01 03:12:38 +0000 nvme: Save cap_lo and cap_hi Save the capabilities for the drive. Sponsored by: Netflix --- sys/dev/nvme/nvme_ctrlr.c | 4 ++-- sys/dev/nvme/nvme_private.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index a632d7fb68e9..95a2b5c4285d 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1388,7 +1388,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) if (bus_get_domain(dev, &ctrlr->domain) != 0) ctrlr->domain = 0; - cap_lo = nvme_mmio_read_4(ctrlr, cap_lo); + ctrlr->cap_lo = cap_lo = nvme_mmio_read_4(ctrlr, cap_lo); if (bootverbose) { device_printf(dev, "CapLo: 0x%08x: MQES %u%s%s%s%s, TO %u\n", cap_lo, NVME_CAP_LO_MQES(cap_lo), @@ -1398,7 +1398,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) (NVME_CAP_LO_AMS(cap_lo) & 0x2) ? " VS" : "", NVME_CAP_LO_TO(cap_lo)); } - cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); + ctrlr->cap_hi = cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); if (bootverbose) { device_printf(dev, "CapHi: 0x%08x: DSTRD %u%s, CSS %x%s, " "MPSMIN %u, MPSMAX %u%s%s\n", cap_hi, diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 977cc2c8d30d..eaf0468096c4 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -284,6 +284,10 @@ struct nvme_controller { /** maximum i/o size in bytes */ uint32_t max_xfer_size; + /** LO and HI capacity mask */ + uint32_t cap_lo; + uint32_t cap_hi; + /** minimum page size supported by this controller in bytes */ uint32_t min_page_size;